Forums

Topic: Petit Computer

Posts 551 to 570 of 9,620

ramstrong

Cocobanana wrote:

Thanks for the fast replys:)

Heres my first line:
Print tab(33);"pokemon tcg"
Is there something wrong with this?

tab isn't a function in Petit Computer. Try this:
LOCATE 10,1: ?"POKEMON TCG"

There is a tab character. You can use that, too.

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

ramstrong

There is your subscript out of range error. Petit Computer takes your tab(33) as Variable Array "tab" element number 33! See how a simple posting of source code clears the issue immediately? Better make that a usual practice!

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Cocobanana

You guys are so helpful!
Thanks so much!

And no, i ment to use a ;..should i use : instead?
Expect to see pokemon tcg soon!
I just have to work on the story line and sprites

Cocobanana

Eel

When you use PRINT (or ?) you can use either , or ; to separate normal text from variables.
, will print the variable after a "tab" while ; will print it right after the text.

: is used to separate different functions on the same line, like PRINT "HI": PRINT "HI AGAIN".

Edited on by Eel

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

KAHN

you heard @Morphtroid(AKA the GOD of programming). do what he says! i doubt he doesnt know what hes talking about, unlike some people emphasis on self

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

KAHN

zfwman wrote:

Morphtroid! Can iplees have ur qr code for petit farm and I'll give u a qr for this great app that I found ( I don't make it)

you dont need to ask him for it buddy, its the internet :/ just go into the depths of the forum and find it for yourself

Edited on by KAHN

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

ramstrong

@Morphtroid
That's great explanation for using commas and semicolon with PRINT. Would you repost it in tutorial thread? It'd be good to keep all the explanations together.

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Cocobanana

Anyone know how to get your own sounds/music?

Cocobanana

ramstrong

Cocobanana wrote:

Anyone know how to get your own sounds/music?

HELP 10,43,44

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Cocobanana

Thanks!

Also, i got this error:
Subscript out of range (11)

My code is:
F(Q)=0

Whats wrong with that?

Cocobanana

Cocobanana

How do you set it with dim?

Cocobanana

portealmario

Don't you just write "DIM F(Q)"?

meng 😐
3ds friend code:1762-2769-7142

Cocobanana

I tried that, but i get this error:
Duplicate definition (11, DIM)

Cocobanana

ramstrong

Cocobanana wrote:

Thanks!

Also, i got this error:
Subscript out of range (11)

My code is:
F(Q)=0

Whats wrong with that?

You need to ask better questions than that because there is nothing wrong with that statement. The error lies somewhere else. It is important that you write the shortest code that still demonstrate the problem. You need to figure out what the problem is and write a sample program that duplicates the same problem. If you have Duplicate Definition Error, you should write this program:
DIM A$[10]
and run it twice. Why did it fail the second time? DIM defines the variable. You cannot redefine variables here. There are different situations that can take advantage of previously defined variables, so this isn't an error. You need to figure out a way around it.

Don't take it the wrong way, but I think you should familiarize yourself with Petit Computer and type in other people's program and see how they work. Otherwise, we'd be porting your program for you, and who knows how long that will take? We're here to help, not do your homework for you. You need to have some initiative yourself.

Try to learn something new everyday, and write a small program to demonstrate your learning. Share if you do. We can use more tutorial pages!

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Cocobanana

Im sorry, its just frustrating when it doesnt work.

One more question, then im done..
Here is my full coding for a dice simulator.
LOCATE 10,1:? "Dice"
PRINT:PRINT:PRINT
DIM F(12)
PRINT "THIS PROGRAM SIMULATES THE ROLLING OF A"
PRINT "PAIR OF DICE."
PRINT "YOU ENTER THE NUMBER OF TIMES YOU WANT THE COMPUTER TO"
PRINT "'ROLL' THE DICE. WATCH OUT, VERY LARGE NUMBERS TAKE"
PRINT "A LONG TIME. IN PARTICULAR, NUMBERS OVER 5000."
FOR Q=1 TO 12
F(Q)=0
NEXT Q
PRINT:PRINT "HOW MANY ROLLS";
INPUT X
FOR S=1 TO X
A=INT(6*RND(1)+1)
B=INT(6*RND(1)+1)
R=A+B
F(R)=F(R)+1
NEXT S
PRINT
PRINT "TOTAL SPOTS","NUMBER OF TIMES"
FOR V=2 TO 12
PRINT V,F(V)
NEXT V
PRINT
PRINT:PRINT "TRY AGAIN";
INPUT Z$
IF Z$="YES" THEN 80
END

But it doesnt work:/
I tried dim F(Q), but it says duplicate definition.

Cocobanana

ramstrong

Eh, whatever happens to the SIMPLEST, SHORTEST code that demonstrate the problem? Sigh.
DIM F(12) means array index is 0..11 so
FOR Q=0 TO 11

You don't need letter after NEXT. So
NEXT
not NEXT S

You need to fix FOR V=2 TO 12 because the array index is insufficient.

Comparison is ==, so
IF Z$=="YES" GOTO @LABEL
There is no line number, so THEN 80 isn't valid.

You need to CLEAR the variables. Put this command on first line.

Randomization works differently. You need to read the help file
A=RND(6)+1

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

ramstrong

CLS:CLEAR
DIM D[13]
INPUT "NUMBER OF DICE ROLLS";N
FOR I=1 TO N
@ROLL
R=RND(6)+RND(6)+2
IF R<2 GOTO @ROLL
D[R]=D[R]+1
NEXT
FOR I=2 TO 12
?I,D[I]
NEXT

Edit:
Don't need @ROLL because randomization is +2, but I figure I'd show you how to do LABEL and GOTO.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Cocobanana

Thanks so much!

It doesnt work with the First line, but it works if you take it out.

Edit: how do you get the QR code?

Edited on by Cocobanana

Cocobanana

triotip

Can someone help me i'm trying to use sphitsp like this IF SPHITSP (1,0) THEN GOSUB @STORE and it won't work (it is in a loop) all that happens is that the store opens as long as the store sprite is on screen.

triotip

Please login or sign up to reply to this topic