DSiWare Forum

Topic: Petit Computer

Showing 121 to 140 of 9,536

AuthorMessage
Avatar

iphys

121. Posted:

The games are saved within the 117 blocks the app takes up on the internal memory, but you can also save them to your SD card as PTC files. The PTC files are meant to be used to generate the QR codes off the website, but can also be used with PTCUtilities to read in your source code and edit it on your computer. It seems no matter how small my programs are, even if they're under 1 KB, the PTC file is something like 33 KB: I have no idea why the PTC versions are so much larger. If there are multiple QR codes for a file, when you scan the first one it knows how many to expect and prompts you to scan them in sequence, and then it saves the file for you when you finish scanning them all.

http://backloggery.com/iphys

3DS Friend Code: 1504-5686-7557 | Nintendo Network ID: iphys_eh

AuthorMessage
AvatarAdmin

theblackdragon

122. Posted:

@6ch6ris6: in the program, on the main screen there's an option for 'File Management'. Tap that option and you'll see an option to 'Read QR Codes"... most programs will have more than one QR code, and the program will walk you through scanning them all, then save the program on your system. it seems to save to the system automatically, because there's also an option 'Save to SD Memory Card' that allows you to copy your programs to the SD card.

edit: or what iphys just said, haha :3

edit the second: arrays are effin' killing me; i've been beating my head against a 'duplicate definition' error for quite a while now with no progress made whatsoever. it's the only DIM in the entire program, and the variable being used isn't used again except when referring to the array; ffs idk wtf i'm doing wrong. i'd kill for some sort of SmileBASIC tutorial that went over everything, because just looking at other peoples' code isn't really cutting it anymore.

Edited on by theblackdragon

BEST THREAD EVER
future of NL >:3
[16:43] James: I should learn these site rules more clearly
[16:44] LztheBlehBird: James doesn't know the rules? For shame!!!
[16:44] Vintage: We have rules?
[16:44] Reala: don't expose the staff to sunlight, don't get them wet and don't feed them after midnight

3DS Friend Code: 3136-6802-7042 | Nintendo Network ID: gentlemen_cat | Twitter: theblackdragon

AuthorMessage
Avatar

Nintenbro

123. Posted:

I was initially very interested in this application, but now I'm not so confident in my abilities to learn how to actually do this. I was thinking of taking this up as a hobby in my spare time, or as a type of introduction into more complex and modern computer programming. It seems like Petit Computer can prove to be a really frustrating experience, and may not be enjoyable enough to redeem itself. Although, I can only imagine the sense of achievement you receive, after producing a program.

Nintendo Bro
3DS FC: 3222-6658-7489

Currently waiting for Luigi's Mansion: Dark Moon & Castlevania: Lords of Shadow - Mirror of Fate

AuthorMessage
Avatar

Morpheel

124. Posted:

Well, this is a great way to waste time and train your logic skills, it will only get as frustrating as you want it to be.

@TBD: Are you sure it is the array the one causing the problem? That does sound like something that shouldn't be happenning. Arrays are not something really complicated. A pic of the problematic line would be useful.

Edited on by Morpheel

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Nintenbro

125. Posted:

@Morphtroid, I'd rather my experience be as smooth as possible. I'm not sure that would be the case, without a user friendly manual. How long do you guys think it would it take to master this application? Also, is this application fully functional on the 3DS?

Edited on by Nintenbro

Nintendo Bro
3DS FC: 3222-6658-7489

Currently waiting for Luigi's Mansion: Dark Moon & Castlevania: Lords of Shadow - Mirror of Fate

AuthorMessage
Avatar

Morpheel

126. Posted:

Well, "mastering" is a weird term but you should be able gain enough skills with practice. As the manual states you can type code directly in run mode (instead of writting a full code and then runing it you can just type it directly into the console) just to see what it does so you can just thinker around if you want or play other's games and try to imagine how they work and then see their code.
I don't know, it's just that the code is so basic that seeing the logic behind most of it is not that hard. I still want to learn how the "data" command works though... I'll get to that after I finish my petit little farm game.
Oh, and getting errors is the most important part of the proccess too, without them you'll never really know how the code works. I would say that finding and fixing errors is the best part.

And, what do you mean by "fully functional with the 3ds"? It works as well as any other DSiWare.

Edited on by Morpheel

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Ralph

127. Posted:

Hey guys found a couple of good links for you while I was looking through GameFAQs:

This thread here is a 'Simple tutorial to help with the basics', it was stickied so it must be good.
http://www.gamefaqs.com/boards/663843-petit-computer/63494042

And in this thread here a guy says he is going to transcribe the manual for Petit Computer, so you can read the manual and program on the DS at the same time, but he isn't finished yet...
http://www.gamefaqs.com/boards/663843-petit-computer/63473618

Ralph

AuthorMessage
Avatar

Mk_II

128. Posted:

It seems like Petit Computer can prove to be a really frustrating experience, and may not be enjoyable enough to redeem itself. Although, I can only imagine the sense of achievement you receive, after producing a program.

well, programming very often is frustrating and sometimes it is so bloody hard that it drives you mad. But if it wasnt a challenge, there would be no sense of achievement at all. No pain, no gain.

Nintendo 64 Forever forum
Nintendo Games NES 241 | SNES 324 | N64 267 | NGC 150 | WII 85 | WIIU 9 | IQUE 5 | GB 161 | GBC 57 | GBA 106 | NDS 57 | 3DS 21
Nintendo Network ID: Mk2_NL 3DS Friend code 0731-4737-4010 AC:NL Dream Code 7600-2509-4051 Animal Crossing Blog

AuthorMessage
Avatar

ejamer

129. Posted:

theblackdragon wrote:

edit the second: arrays are effin' killing me; i've been beating my head against a 'duplicate definition' error for quite a while now with no progress made whatsoever. it's the only DIM in the entire program, and the variable being used isn't used again except when referring to the array; ffs idk wtf i'm doing wrong. i'd kill for some sort of SmileBASIC tutorial that went over everything, because just looking at other peoples' code isn't really cutting it anymore.

[/div]

Are you using CLEAR at the start of your code?

When you run a program, you should always initialize variables before using them because memory doesn't get cleared at the end of the program and you might carry over old variable values next time you start. For example, enter this program:

1 PRINT NUM
2 NUM=NUM+1
3 END

Then run the program a few times. You'll notice that every time you run it, the printed value increases because NUM isn't reset after the program ends. To reset the value, either add CLEAR as the first line of your code or enter CLEAR manually before running your program next time - suddenly all variables are forgotten and you go back to 0.

For normal string and numeric variables, forgetting to CLEAR old data won't make the program crash, but arrays are tricky because you can't DIM an array twice. If your code tries to use the DIM MyArray(number) statement when that array already exists, then you're going to get an error! In this case it becomes important to CLEAR all variables before running the program a second time - or to change your code so that you don't DIM an array that already exists.

One last warning: when you use CLEAR, all variables disappear. Arrays no longer exist, any variables that you had created or set values for previously will disappear, and you are starting with fresh memory. You can't just clear one or two variables... so only use the CLEAR statement when you want a blank slate to work with.

If you would rather set up a separate subroutine to handle array initialization, you might try something like this:

1 IF ArrayExists==0 THEN GOSUB @CreateArray
2 (your program code here)
3 END
4 -------
5 @CreateArray
6 DIM MyArray(10)
7 ArrayExists=1
8 RETURN

What does that do? There is a variable in the first line called ArrayExists that is a number with a default value of 0 the very first time your program is run. So the very first time you run the program you know that arrays don't exist and go to the little subroutine called @CreateArray that uses the DIM statement and sets the ArrayExists value to TRUE. Every time afterwards your program will remember if the array already exists and only use the DIM statement if it's necessary.

One other tip: you may see the constant values TRUE and FALSE used. These constant values have numerical values of FALSE=0 and TRUE=1, and you can use the constants instead of number when it makes your code more clear. So you could change line 1 to IF ArrayExists==FALSE THEN... and line 7 to ArrayExists=TRUE. You can also use an exclamation point use the opposite true/false value, so line 1 could be shortened to: IF !ArrayExists THEN, which would be read as "if not arrayexists then". This isn't necessary, but is commonly seen so it's worth mentioning.

And a final note: for an IF statement, any non-zero value equates to true. So IF 0 THEN PRINT "TEST" does nothing but IF 1 THEN, or IF -7 THEN, or IF 8384678792 THEN... will all work just fine.

(edited multiple times for clarity)

Edited on by ejamer

ejamer

Nintendo Network ID: ejamer

AuthorMessage
AvatarAdmin

theblackdragon

130. Posted:

@ejamer: thanks, man, that did it — i had a CLS beforehand instead of a CLEAR. that would explain why it'd throw me a different error first and then keep giving me duplicate definition ones afterward, haha D: also, it's kinda the 'startup initialization' of the program, so it's only coded to run once per use in the program; you'd have to restart the entire thing in order to hit that CLEAR again.

now it's giving me syntax errors with the READ command. what i'm trying to do is construct a 9-room test environment, each room with four possible directions in which to go. this is what i've got so far:

CLEAR
DIM A(8,3)
FOR B=1 TO 9
FOR C=1 TO 4
READ A(B,C)
NEXT C
NEXT B

... and then my DATA afterward. it consistently gives me a syntax error at the READ line, though, and I realize there's no use of parentheses shown in the manual, but i've checked some of the other included code, and it seems to do this kind of thing there with no problem (GAME2).

i'd assume it's because i don't have any other parameters set at the moment, but yesterday i transcripted the full program from the aforementioned page (had to in order to get rid of all the line-numbers), QR'd it and got it into my 3DS, fiddled with it for a while, and then crapped out at the same place — syntax error on the READ line. if the problem were with the DATA or another line, it'd give me an error for those and not the READ line, wouldn't it? my ultimate goal at this point in time is to get that adventure-game program from the site i found yesterday up and running, but SmileBASIC is pretty different from what he's used (plus there seem to have been several spelling/syntax errors included on accident in the process of getting it up on the internet!). i'm kinda learning by translation at this point, but i keep getting stuck.

/rambling D:

Edited on by theblackdragon

BEST THREAD EVER
future of NL >:3
[16:43] James: I should learn these site rules more clearly
[16:44] LztheBlehBird: James doesn't know the rules? For shame!!!
[16:44] Vintage: We have rules?
[16:44] Reala: don't expose the staff to sunlight, don't get them wet and don't feed them after midnight

3DS Friend Code: 3136-6802-7042 | Nintendo Network ID: gentlemen_cat | Twitter: theblackdragon

AuthorMessage
Avatar

ejamer

131. Posted:

First, arrays always start counting at zero. When you use the DIM statement, you specify how big the array is (SIZE), but when you try to get or set values be sure to use (SIZE-1). See the example below for details:

DIM MyArray$(4)
MyArray$(0)="First array entry"
MyArray$(1)="Second array entry"
MyArray$(2)="Third array entry"
MyArray$(3)="Fourth and final array entry"
For I=0 to 3
PRINT STR$(I)+": "+MyArray$(I)
Next

If I try to use MyArray$(5) to store some information or even MyArray$(4) then I'm going to get an error popping up - and your FOR loop definitely goes too high compared to the actual size your declared array. Try using B=0 TO 7 and C=0 TO 3 instead.

Second, if you are more specific about the error you get it will help track down the problem. An "Out of DATA" error would indicate that your DATA statement doesn't have enough entries and you are trying to READ content that doesn't exist. A "Subscript out of range" error means that you are trying to access an array but the numbers being used are either too big or too small. If the error is something else then...? The Help manual included with Petit Basic has a page called BASIC Standard Features > Error Number Chart that might help track down the problem.
:)

Learning is a slow process, but when you finally get that program to run it is (usually) very rewarding!

Edited on by ejamer

ejamer

Nintendo Network ID: ejamer

AuthorMessage
AvatarAdmin

theblackdragon

132. Posted:

ejamer wrote:

First, arrays always start counting at zero. When you use the DIM statement, you specify how big the array is (SIZE), but when you try to get or set values be sure to use (SIZE-1).

oh geez, i think i had it backwards — i knew arrays in SmileBASIC start with 0 but i thought the numbers in the DIM line had to be what started from 0 (which is why i stated 8 for a total number of 9 rooms) and then the set values could start from 1 if i wanted to. i'm a dork D:

also, when i input the correct numbers

DIM A(9,4)
FOR B=0 TO 8
FOR C=0 TO 3
READ A(B,C)
NEXT C
NEXT B

it still didn't work — gave me a 'type mismatch' error (btw, i'm using the exact error terminology it's throwing at me, which is why i kept saying it was a 'syntax error' before, and originally the 'duplicate definition' error :3). however, i noticed you keep using that $ symbol, so when i tried inputting

DIM A$(9,4)
FOR B=0 TO 8
FOR C=0 TO 3
READ A$(B,C)
NEXT C
NEXT B

it finally started kicking me to the next problem with the program, so it looks like a combination of fixing the array size and sticking that $ in there took care of it. why does that work? i have no idea D:

anyway, i'll play around with it a bit more once i get into work, lol. thanks for all your help, i really appreciate it :3

Edited on by theblackdragon

BEST THREAD EVER
future of NL >:3
[16:43] James: I should learn these site rules more clearly
[16:44] LztheBlehBird: James doesn't know the rules? For shame!!!
[16:44] Vintage: We have rules?
[16:44] Reala: don't expose the staff to sunlight, don't get them wet and don't feed them after midnight

3DS Friend Code: 3136-6802-7042 | Nintendo Network ID: gentlemen_cat | Twitter: theblackdragon

AuthorMessage
Avatar

Morpheel

133. Posted:

The $ means it is an alphanumerical array, in other words, it is meant to store characters and numbers in text form instead of just numbers.

You should put the $ in the name of every variable you want to use with characters.
And note, any numbers stored in a $ variable can't be used for equations, you must transform them to numerical values using the VAL command.

Edited on by Morpheel

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

ejamer

134. Posted:

Morphtroid wrote:

The $ means it is an alphanumerical array, in other words, it is meant to store characters and numbers in text form instead of just numbers.

You should put the $ in the name of every variable you want to use with characters.
And note, any numbers stored in a $ variable can't be used for equations, you must transform them to numerical values using the VAL command.

(Thumbs Up!)

A variable (or array) with $ at the end means that you are dealing with multiple characters of text - often called strings - that must be entered using quotation marks. Otherwise you are limited to numbers. Numbers and text generally don't mix unless you change them to the same format. You can change the number 3 into the text "3" by using STR$(3). Vice-versa by using VAL("3"). Numbers are good for math, strings are good for manipulating with functions described in the Search & Replace section of the help manual.

ejamer

Nintendo Network ID: ejamer

AuthorMessage
Avatar

Morpheel

135. Posted:

Oh, and to generate saves for your games you will most likely need to use str$(), val() and the "search and replace" functions ejamer mentioned.
To save the state of your game you need to fill the MEM$ variable which you can then save using SAVE"MEM:name of the file" and load using LOAD"MEM:name of the file".
All you need to do is save all the important variables values to that file at the moment of saving and then download them back on the variables when you want to load.
I think I read that every mem file is limited to 255 bytes (1 character = 1 byte) so you need to squeeze all you can out from those bytes.

Edited on by Morpheel

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Shadowflash

136. Posted:

This is probably a stupid question, but is there a major difference between BASIC and QBASIC?

"Can you do that? Can you explode twice?!" -Spike

3DS FC: 1676-3897-8278

3DS Friend Code: 1676-3897-8278 | Twitter: Shadowflash0

AuthorMessage
Avatar

ejamer

137. Posted:

Shadowflash wrote:

This is probably a stupid question, but is there a major difference between BASIC and QBASIC?

Short answer:
Not a major difference, but there usually are important differences.

Long answer:
There are many different flavors of BASIC that all come from the same basic starting point, but every flavor will make minor changes. This link shows a list of different types of BASIC: http://en.wikipedia.org/wiki/List_of_BASIC_dialects

Different versions of the BASIC programming language (including SmileBASIC - the version used in Petit Computer) are all subtly changed because they are designed for different purposes or hardware. If you know one version, then most of what you know will translate over to the others very well because all BASIC language have a common starting point... but you'll still need to learn what is changed and why. Check the Wikipedia link below and you'll see a section about Syntax that discusses some of the most common aspects of the BASIC family of langauges.

http://en.wikipedia.org/wiki/BASIC

As an example of changes, in SmileBASIC we have a few extra graphical and touch-screen specific features that make it easy to work with the DS but wouldn't be found in "normal" BASIC, as well as some changes to basic syntax that are important to note. See the Introduction > Program Precautions section of the help manual to get an idea about the most important changes.

However, if you are just starting programming then learning any BASIC will help you get a good start and teach some of the most important concepts. QBASIC is a good place to start learning some programming tips, just realize that you can't do a straight translation of QBASIC code into Petit Computer and that you'll have to figure out where and why changes are required largely on your own.

Edited on by ejamer

ejamer

Nintendo Network ID: ejamer

AuthorMessage
Avatar

JohnDoe123

138. Posted:

I got the program, and I must say that it was overwhelming at the beginning. It's hard to start using at first. I think I'm better now, but I still don't have any realistic game ideas for my current programming level.

JohnDoe123

3DS Friend Code: 0259-0286-9394

AuthorMessage
Avatar

Morpheel

139. Posted:

I'd recommend you to read the included manual from the first page and test things out as they appear. Other than that, reading this thread from the first page may be helpful too. If everything else fails, try google.

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

JohnDoe123

140. Posted:

I'm starting to regret buying this now. I can't seem to do anything other than display text. The manual is poorly put together, it's a very non user friendly program.

JohnDoe123

3DS Friend Code: 0259-0286-9394