DSiWare Forum

Topic: Petit Computer

Showing 561 to 580 of 9,519

AuthorMessage
Avatar

ramstrong

561. Posted:

Cocobanana wrote:

Anyone know how to get your own sounds/music?:p

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

AuthorMessage
Avatar

Cocobanana

562. Posted:

Thanks!

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

My code is:
F(Q)=0

Whats wrong with that?

Cocobanana

AuthorMessage
Avatar

Morpheel

563. Posted:

again, you are tring to use an array (F(Q)) without setting it with DIM.

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

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

AuthorMessage
Avatar

Cocobanana

564. Posted:

How do you set it with dim?

Cocobanana

AuthorMessage
Avatar

portealmario

565. Posted:

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

meng ūüėź
3ds friend code:1762-2769-7142

AuthorMessage
Avatar

Cocobanana

566. Posted:

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

Cocobanana

AuthorMessage
Avatar

ramstrong

567. Posted:

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

AuthorMessage
Avatar

Cocobanana

568. Posted:

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

AuthorMessage
Avatar

ramstrong

569. Posted:

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

AuthorMessage
Avatar

ramstrong

570. Posted:

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

AuthorMessage
Avatar

Cocobanana

571. Posted:

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

AuthorMessage
Avatar

triotip

572. Posted:

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

AuthorMessage
Avatar

ramstrong

573. Posted:

triotip wrote:

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.

You don't make it easy for us to help you, do you? Did not Cocobanana just now had trouble getting his question answered because he didn't give out enough info? From now on, unless the question is well formed, I don't want to answer. What kind of questions are good ones? Petit Tutorial Forum post#9.

In your case, though, I'd say that the store opens only when the sprite in on screen because you did not supply a Status/Flag variable that specify the store should be open when the sprite is off screen. That is:
STORE=OPEN if SPRITE=HIT
when what you want is
SHOULDOPEN=TRUE if SPRITE=HIT
STORE=OPEN if SHOULDOPEN=TRUE

That's just pseudocode. You need to do the programming yourself. You also need to specify the condition when the store should close. Be careful, you don't want to close the store when the sprite isn't hit!

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

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

triotip

574. Posted:

okay let me reform my question because your answer didn't fix my problem.
i have a sprite in the middle of the screen that represents your character and another sprite that represents the store.
i want the store to open when your sprite hits the store sprite.

triotip

AuthorMessage
Avatar

Cocobanana

575. Posted:

I never knew it was bad to ask a question,

Cocobanana

AuthorMessage
Avatar

ramstrong

576. Posted:

Cocobanana wrote:

I never knew it was bad to ask a question,

Depends on the question. Did you read the tutorial post? Here's an example:

You know how PRINT statement works, right? What if there's somebody who ask help like this: "How do you use PRINT?", following your answer with "It doesn't work."

Here's what I want to see:

When I see the words "I don't understand ..." it'd better be followed by "These are the things I tried in order to understand it."

See the difference?

Please,please, please read the tutorial post. It will make life much easier for everybody.

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

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

Cocobanana

577. Posted:

Im sorry, ill post it that way next time.

And i have not read the tutorial, i thought i already knew how to use this lol.

Cocobanana

AuthorMessage
Avatar

Cocobanana

578. Posted:

Heres a question, hopefully i ask it better.

Im trying to figure out how to use MML on petit computer.
I was wondering if this would work on it, or is there something i have to add?
http://www.mabinogiworld.com/showthread.php?7555-D-Super-Mari...

Cocobanana

AuthorMessage
Avatar

portealmario

579. Posted:

Is there a command that stops the computer from going through coding and waits for the user to press any key to continue(like the "sleep" command in other BASIC languages)?

meng ūüėź
3ds friend code:1762-2769-7142

AuthorMessage
Avatar

Morpheel

580. Posted:

You can make a loop with goto and if.

Oops, no username pun.

Oh look! A Morphloggery.
Oh! eShop Gurus.

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