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(3)=8:Then
Ã¡MYS(1)+1Ã¼Ã¡MYS(1):Ã¡MYS(5)-112Ã¼Ã¡MYS(5)
Ã¡MYS(3)-7Ã¼Ã¡MYS(3)
prgmZTOWN1
End
If Ã¡MYS(3)<8:Then
If sub(Str1,Ã¡MYS(5)+16,1)Ã¸"X":Then
Output(Ã¡MYS(3),Ã¡MYS(4),"
Ã¡MYS(3)+1Ã¼Ã¡MYS(3):Ã¡MYS(5)+16Ã¼Ã¡MYS(5)
End:End:End
End

Works perfectly.
When I add this code after "getKeyÃ¼Ã¡MYS(7)", it goes wrong:

If Ã¡MYS(7)=11:Then
ClrHome
Lbl 1
If Ã¡MYS(7)=11:Then
ClrHome
Output(1,1,"HPÃº"
Output(1,6,Ã¡STAT(1)
Output(1,9,"/"
Output(1,12,Ã¡STAT(5)
Output(2,1,"MPÃº"
Output(2,6,Ã¡STAT(2)
Output(2,9,"/"
Output(2,12,Ã¡STAT(6)
Output(3,1,"STRÃº"
Output(3,6,Ã¡STAT(3)
Output(4,1,"DEFÃº"
Output(4,6,Ã¡STAT(4)
Output(5,1,"EXPÃº"
Output(5,6,Ã¡MYS2(4)
Output(5,9,"/"
Output(5,12,Ã¡MYS2(5)
Pause :End
Lbl 3
If Ã¡MYS(7)=11:Then
prgmA:End
Lbl 4
If Ã¡MYS(7)=11:Then
Stop:End
Lbl 5
If Ã¡MYS(7)=11:Then
End

prgmA is the game. I run it, then it runs again, and again. It seems to be reading Lbl 3, right?
I never hit a button. I never hit Y= button, therefore Ã¡MYS(7) is not 11.
How can this be happening? How can I fix it?
Ok, first thing:

You should try to stay away from Lbl/Goto commands when using this type of engine.

Secondly:

Don't store getkey values to a list element, as it takes the calc longer to access that list slot. You should store it in a variable. Same thing with the While Statement.

And yes, It looks like the code is working like you are telling it to.

What is
Code:
Ã¡MYS(7)=11
???
getkey -> Ã¡MYS(7)

Ã¡MYS(7)=11 is the Y= button.

EDIT:
How do you suppose I make it work without LBL - GOTO?
lol, now I see it.

When using Lbl commands, you can get rid of the If :Then End stuff. Just to let you know...
Err, the question remains; why is this happening? If I never clicked the Y= button, why is it reading the line of code 'If Ã¡MYS(7)=11:Then
prgmA:End'?
yeah, i don't feel copying it just to be able to read it. Can you run it thru SC or whatever so that its legible?
:While W=3
:Output(LMYS(3),LMYS(4),"
:If sub(Str1,LMYS(5),1)" ":Then:prgmZCH:End
:getKeyK
:If K=11:Then
:ClrHome
:Lbl 1
:ClrHome
:Output(1,1,"HP-"
:Output(1,6,LSTAT(1)
:Output(1,9,"/"
:Output(1,12,LSTAT(5)
:Output(2,1,"MP-"
:Output(2,6,LSTAT(2)
:Output(2,9,"/"
:Output(2,12,LSTAT(6)
:Output(3,1,"STR-"
:Output(3,6,LSTAT(3)
:Output(4,1,"DEF-"
:Output(4,6,LSTAT(4)
:Output(5,1,"EXP-"
:Output(5,6,LMYS2(4)
:Output(5,9,"/"
:Output(5,12,LMYS2(5)
:Pause :End
:Lbl 3
:prgmA:End
:Lbl 4
:Stop:End
:Lbl 5
:End
:If K=24:Then
:If LMYS(4)=1:Then
:LMYS(2)-1LMYS(2):LMYS(5)+15LMYS(5):15+LMYS(4)LMYS(4)
:prgmZTOWN1
:End
:If LMYS(4)>1:Then
:If sub(Str1,LMYS(5)-1,1)"X":Then
:Output(LMYS(3),LMYS(4),"
:LMYS(4)-1LMYS(4):LMYS(5)-1LMYS(5)
:End:End:End
:If K=25:Then
:If LMYS(3)=1:Then
:LMYS(1)-1LMYS(1):LMYS(5)+112LMYS(5):LMYS(3)+7LMYS(3)
:prgmZTOWN1
:End
:If LMYS(3)>1:Then
:If sub(Str1,LMYS(5)-16,1)"X":Then
:Output(LMYS(3),LMYS(4),"
:LMYS(3)-1LMYS(3):LMYS(5)-16LMYS(5)
:End:End:End
:If K=26:Then
:If LMYS(4)=16:Then
:LMYS(2)+1LMYS(2):LMYS(5)-15LMYS(5):LMYS(4)-15LMYS(4)
:prgmZTOWN1
:End
:If LMYS(4)<16:Then
:If sub(Str1,LMYS(5)+1,1)"X":Then
:Output(LMYS(3),LMYS(4),"
:LMYS(4)+1LMYS(4):LMYS(5)+1LMYS(5)
:End:End:End
:If K=34:Then
:If LMYS(3)=8:Then
:LMYS(1)+1LMYS(1):LMYS(5)-112LMYS(5)
:LMYS(3)-7LMYS(3)
:prgmZTOWN1
:End
:If LMYS(3)<8:Then
:If sub(Str1,LMYS(5)+16,1)"X":Then
:Output(LMYS(3),LMYS(4),"
:LMYS(3)+1LMYS(3):LMYS(5)+16LMYS(5)
:End:End:End
Try takin out the list element, and puttin in a Real variable...

Also, you so not have enough End statements there.

Quote:
Lbl 1
:ClrHome
:Output(1,1,"HP-"
:Output(1,6,LSTAT(1)
:Output(1,9,"/"
:Output(1,12,LSTAT(5)
:Output(2,1,"MP-"
:Output(2,6,LSTAT(2)
:Output(2,9,"/"
:Output(2,12,LSTAT(6)
:Output(3,1,"STR-"
:Output(3,6,LSTAT(3)
:Output(4,1,"DEF-"
:Output(4,6,LSTAT(4)
:Output(5,1,"EXP-"
:Output(5,6,LMYS2(4)
:Output(5,9,"/"
:Output(5,12,LMYS2(5)
:Pause :End
:Lbl 3
:prgmA:End
:Lbl 4
:Stop:End

Remove all the End statements that I posted...
Dan's a genius.

Can you explain how those extra End statements were killing it?

And, I like lists better. I had variables, spent the last 30min doing find/replace to make 'em all list characters. But, I did make getkey K and while W, upon your advice.
Every If:Then requires an End, as does While and Repeat. If you don't have enough End statements in there it will cause some very very funky things to happen. If you have too many in there, you will either kill the loop prematurely, or get a syntax error...
End stops While. *note to self*
prgmZEN:

:randInt(1,10)LMYS2(1)
:If LMYS2(1)2:Then
:"Beaver"Str0
:{4,1,2,1,15}LMONST
:Goto AA:End
:If LMYS2(1)3 and LMYS2(1)4:Then
:"Rabbit"Str0
:{3,1,1,1,10}LMONST
:Goto AA:End
:If LMYS2(1)5:Then
:" "Str2
:sub(Str1,1,T-1)+Str2+sub(Str1,T+1,length(Str1)-TStr1
:Return :End
:Lbl AA
:ClrHome
:Lbl 1
:randInt(0,LSTAT(3))LMYS2(2)
:ClrHome
:Output(1,1,"You deal"
:Output(1,10,LMYS2(2)
:Pause
:LMONST(1)-LMYS2(2)LMONST(1)
:If LMONST(1)0:Then
:Goto KK:End
:Goto BB
:Lbl 2
:Lbl 5
:ClrHome
:If LSTAT(2)2:Then
:LSTAT(2)-2LSTAT(2)
:LSTAT(1)+10LSTAT(1)
:If LSTAT(1)>LSTAT(5):Then
:Output(1,1,"You heal to fullHP!"
:Pause
:LSTAT(5)LSTAT(1)
:Goto BB:End
:Output(1,1,"You heal 10 HP"
:Pause
:Goto BB:End
:Output(1,1,"Not enough MP"
:Pause
:Goto AA
:Lbl 6
:ClrHome
:If LSTAT(2)4:Then
:LSTAT(2)-4LSTAT(2)
:randInt(0,4)LMYS2(2)
:LMONST(1)-LMYS2(2)LMONST(1)
:Output(1,1,"You deal"
:Output(1,10,LMYS2(2)
:Pause
:If LMONST(1)0:Then
:Goto KK:End
:Goto BB:End
:Output(1,1,"Not enough MP"
:Pause
:Goto AA
:Lbl 7
:If LSTAT(2)8:Then
:LSTAT(2)-8LSTAT(2)
:randInt(0,8)LMYS2(2)
:LMONST(1)-LMYS2(2)LMONST(1)
:Output(1,1,"You deal"
:Output(1,10,LMYS2(2)
:Pause
:If LMONST(1)0:Then
:Goto KK:End
:Goto BB:End
:Output(1,1,"Not enough MP"
:Pause
:Goto AA
:Lbl 8
:Goto AA
:Lbl 3
:ClrHome
:Output(1,1,"HP-"
:Output(1,6,LSTAT(1)
:Output(1,9,"/"
:Output(1,12,LSTAT(5)
:Output(2,1,"MP-"
:Output(2,6,LSTAT(2)
:Output(2,9,"/"
:Output(2,12,LSTAT(6)
:Output(3,1,"STR-"
:Output(3,6,LSTAT(3)
:Output(4,1,"DEF-"
:Output(4,6,LSTAT(4)
:Output(5,1,"EXP-"
:Output(5,6,LMYS2(4)
:Output(5,9,"/"
:Output(5,12,LMYS2(5)
:Pause
:Goto AA
:Lbl 4
:randInt(1,4)LMYS2(3)
:If LMYS2(3)=1:Then
:ClrHome
:Output(1,1,"You ran away! (WIMP!)"
:Pause
:ClrHome
:prgmZTOWN1:Return :End
:If LMYS2(3)2:Then
:ClrHome
:Output(1,1,"You fail to run! (FAILURE!)"
:Pause
:ClrHome
:Goto BB:End
:Lbl KK
:ClrHome
:Output(1,1,"You kill"
:Output(2,1,Str0
:Pause
:LMYS2(4)+LMONST(5)LMYS2(4)
:prgmZLVL:prgmZTOWN1:prgmZGA
:Lbl BB
:randInt(0,LMONST(3))S
:ClrHome
:Output(1,1,Str0
:Output(2,1,"deals"
:Output(2,7,S
:Pause
:LSTAT(1)-SLSTAT(1)
:If LSTAT(1)0:Then
:ClrHome
:Output(1,1,"You die..."
:Pause
:Stop:End
:Goto AA

Whenever I do a battle, or 5, it lags. The more I fight, the more this prgm runs, the more it lags. My character ends up moving VERY slowly.
Is this because I am using lists for variables?
If so, is there any other way I can do this other than lists and variables?
Goto in side of an If:Then:End statement = Memory leak = Program slowing down.

Take care of those problems first...
What do you suppose I do instead of goto?
What do you suppose I do instead of goto?

just remember this:

it can be very difficult to rework a program so that no goto's or labels are used, but the payoffs are huge.
I seperated the Battle system from the Enemy data program. Just have it load the enemy data, and the last bit of code should call the battle program, then return back to the original calling program...
Well, did that, but my batteries ran out; what luck.

I'll try it soon as I get batteries and tell you if it works.
Use something like this instead:

Code:
:DelVar J
:If (STUFF)=WHATEVER
:Then
:Check
:Stuff
:1->J
:End
:If J:Goto LB
I'm confused on this:

:Check
:Stuff
:1->J
:End
:If J

What is 'check'?
Is 'stuff' the same as the first 'STUFF'?
What does 'If J' mean?
Alrighty. This part is the for loop or if loop or whatever:

Code:
:If (STUFF)=WHATEVER
:Then
:Check
:Stuff
:1->J
:End

Check Stuff is just whatever you want inside the loop. J is a variable used to store whether you're going to jump or not. If J is equivalent to If J=/=0.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum