Date: 05 May 2014 19:45
Number of posts: 7
RSS: New posts
Because Z=0 at the start of the program (unless you set it to something else outside of your program), the program will jump straight to Lbl AB.
For easier viewing, here is your exact code.
Lbl 00 //Intro ClrDraw ClrHome RecallPic 1 24→X If Z=0 Then Goto AB End Else Goto 01 End Lbl 01 //Main Menu ClrHome Text(24,16," ") Text(30,16," ") Text(36,16," ") Text(X,16,">") While 1 Repeat Z getKey→Z If Z=25 //Scroll Up Then If X>=30 Then X-6->X Goto 01 Else Goto 01 End End If Z=34 //Scroll Down Then If X<=30 Then X+6->X Goto 01 Else Goto 01 End End If Z=105 //Selection & Menus Then If X=24 Then Goto 10 End If X=30 Then Goto 20 End If X=36 Then Stop End End End Lbl 10 //Game Screen/Statistics ClrHome ClrDraw Text(1,24,"*=Tapper 3=*") Text(7,1,"Points: ") Text(13,1,"Lifetime: ") Text(19,1,"Manual Boost: ") Text(25,1,"Tokens/Boost: ") Text(32,1,"Rank: ") Text(56,11,"Shop") Text(56,39,"Quit") Text(56,67,"Reset") If P>K //Shorten Points Then Text(7,49,P/K,"K") End If P>M Then Text(7,49,P/M,"M") End If P>B Then Text(7,49,P/B,"B") End If P>T Then Text(7,49,P/T,"T") End If P>Q Then Text(7,49,P/Q,"Q") End If P<K Then Text(7,49,P) End If L>K //Shorten Lifetime Then Text(13,49,L/K,"K") End If L>M Then Text(13,49,L/M,"M") End If L>B Then Text(13,49,L/B,"B") End If L>T Then Text(13,49,L/T,"T") End If L>Q Then Text(13,49,L/Q,"Q") End If L<K Then Text(13,49,L) End Text(19,49,D) //Boosts & Rank Text(25,49,C) Text(32,49,"Names not made-",R) While 1 //Gameplay/Open Menu getKey->Z Repeat Z If Z=105 //Configure New Points Then Goto AA End If Z=25 //Open Game Menu Then 6->X 28->Y Goto 11 End End End Lbl 11 //Game Menu Selector Text(56,6," ") Text(56,28," ") Text(56,34," ") Text(56,56," ") Text(56,62," ") Text(56,88," ") Text(56,X, "[") Text(56,Y, "]") While 1 getKey->Z Repeat Z If Z=24 //Cursor Left Then If X=62 and Y=88 Then 34->X 56->Y Goto 11 End If X=34 and Y=56 Then 6->X 28->Y Goto 11 End Else Goto 11 End End If Z=26 //Cursor Right Then If X=6 and Y=28 Then 34->X 56->Y Goto 11 End If X=34 and Y=56 Then X=62 Y=88 Goto 11 End Else Goto 11 End End If Z=105 //Select Choice Then If X=6 Then Goto 20 End If X=34 Then Stop End If X=62 Then Goto ZZ End End If Z=34 //Close Game Menu Then Goto 10 End Lbl AA //Configure New Points ClrHome ClrDraw P+(B*T)->P L+(B*T)->L Goto RR Lbl AB //First Time Variables 0->P //Points 1->D //Manual Boost 0->L //Lifetime 0->C //Token Boost 0->R //Rank 1->V //Not First Time 0->U //No Upgrades 1000->K //Shorthands 1000000->M 1000000000->B 1000000000000->T 1000000000000000->Q Goto 10 Lbl RR //Determine Rank If L>=250 Then R=1 End If L>=3K Then R=2 End If L>=20K Then R=3 End If L>=100K Then R=4 End If L>=315K Then R=5 End If L>=1M Then R=6 End If L>=6.5M Then R=7 End If L>=30M Then R=8 End If L>=120M Then R=9 End If L>=600M Then R=10 End If L>=2.4B Then R=11 End If L>=10B Then R=12 End If L>=40B Then R=13 End If L>=210B Then R=14 End If L>=800B Then R=15 End IF L>=3.5T Then R=16 End If L>=25T Then R=17 End If L>=130T Then R=18 End If L>=600T Then R=19 End If L>=1.5Q Then R=20 End Else End Goto 10 Lbl ZZ //Reset & Prestige ClrHome ClrDraw Disp("Not done.") Pause Goto 10 Lbl 20 //The Shop ClrHome ClrDraw Disp("The Shop... is closed.") Pause Goto 10
for repeated constants like 59 or 7, first store it to a variable and use the variable. smaller size.
The Silver Phantom welcomes you
Well to begin, you might want to consider some optimization, for example, if there is only one line in an if statement, you do not need 'then' and 'end'.
If A=3 Then 5->A End
If A=3 5->A
Also, line 9 should not exist. It should be If…Then…Else…End instead of If…Then…End…Else…End
I would not suggest jumping out of a loop at any time, especially repeatedly, this can cause lots of lag and fill up the ram.
It appears that the program is stuck in the first while loop under Lbl 01. While 1 creates an infinite loop. Repeat Z will repeat until Z≠0, however, if Z is not 0 this is skipped, the repeat loop is being skipped infinitely, I believe this is causing the problem you described, to fix this you could set the value of Z to 0 before Repeat Z, or it looks like you could remove the repeat entirely.
Try optimizing your code a bit and see if there are any other problems.
When you use multiple commands that modify both the graph screen and the home screen, you should group the commands according to the screen they modify to avoid switching constantly between the graph and home screens:
ClrDraw ClrHome RecallPic 1
ClrHome ClrDraw RecallPic Pic1
ClrHome ClrDraw Disp("Not done.") Pause
can be optimized as
ClrDraw ClrHome Pause "Not done.
Alright, changed a few things in my code to make it work, and optimzed my if statements (Thank you, earthnite). The problem with my while statement was very simple, and much easier to fix than I imagined. Firstly, I got rid of using Z to check the initial check for gameplay (Also thank you, electromagnet8). I still wanted to keep it for my own purposes, so I used Y instead. Secondly, the getKey( funtion was before my repeat, so that was an obvious fix. I also used While Z!=1, which is the same, but I just like it more.
Before I add the Shop and Prestige options to my game, I just wanted to see if I could optimize my ranks and shorthands. I recently learned how to use lists, but I still find them a bit complicated and inconvenient for sorting this out. If I wanted to store all my shorthand variables to one list and my rank list to another (say LSHORT and LRANK), is there any easy way to check if a variable is greater than the highest value in the list? For example:
//How can I optimize this?
//Etc. If I were to use it to figure out what rank I am in a list, how could I do this?
Thanks, and if any other bugs/suggestions show up, let me know.
Sorry, don't know how to put code in a post, so here's the new link:
http: // pastebin.com /FwKqbnJX (Anti-spam blocks link)
You can use max( to find the greatest value in a list:
If Y>max(L₁ Goto 0
If you are just comparing the value of Y to preset values in ∟ODD, if would be more optimized to eliminate ∟ODD and just use the numbers
5->Y If Y>9 Goto 0 If Y>7 Goto 1 If Y>5 Goto 2 If Y>3 Goto 3
You can put code in the post by using the "[[code]] [[/code]]" block.