dopeheaddude wrote:
pgrmZGA:

While áMYS(6)=3
Output(áMYS(3),áMYS(4),"Á
If sub(Str1,áMYS(5),1)ø" ":Then:prgmZCH:End
getKeyüáMYS(7)
If áMYS(7)=24:Then
If áMYS(4)=1:Then
áMYS(2)-1üáMYS(2):áMYS(5)+15üáMYS(5):15+áMYS(4)üáMYS(4)
prgmZTOWN1
End
If áMYS(4)>1:Then
If sub(Str1,áMYS(5)-1,1)ø"X":Then
Output(áMYS(3),áMYS(4),"
áMYS(4)-1üáMYS(4):áMYS(5)-1üáMYS(5)
End:End:End
If áMYS(7)=25:Then
If áMYS(3)=1:Then
áMYS(1)-1üáMYS(1):áMYS(5)+112üáMYS(5):áMYS(3)+7üáMYS(3)
prgmZTOWN1
End
If áMYS(3)>1: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
If áMYS(7)=26:Then
If áMYS(4)=16:Then
áMYS(2)+1üáMYS(2):áMYS(5)-15üáMYS(5):áMYS(4)-15üáMYS(4)
prgmZTOWN1
End
If áMYS(4)<16:Then
If sub(Str1,áMYS(5)+1,1)ø"X":Then
Output(áMYS(3),áMYS(4),"
áMYS(4)+1üáMYS(4):áMYS(5)+1üáMYS(5)
End:End:End
If áMYS(7)=34:Then
If áMYS(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
Menu("Menu","Stats",1,"Reset",3,"Quit",4,"Return",5)
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. Smile

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
:Menu("Menu","Stats",1,"Reset",3,"Quit",4,"Return ",5)
: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
:Menu(Str0,"SWORD",1,"MAGIC",2,"STATS",3,"RUN",4
: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
:Menu("MAGIC","CURE",5,"Lightning",6,"Fire",7,"BACK",8
: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? Confused
dopeheaddude wrote:
What do you suppose I do instead of goto? Confused


just remember this:

goto == bad Wink

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. Smile
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.

» Go to Registration page
» Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
» View previous topic :: View next topic  
Page 1 of 10
» 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

 

Advertisement