0 Members and 2 Guests are viewing this topic.
Goto M //Start of Subroutine section. We want it to be at the top of the program, as all subroutines are accessed via lables //This code is skipped due to the Goto M statementLbl A //Subroutine ADisp "This is a fun sub"Disp "Its over 9000"EndLbl MDisp "Main program foo'!" //This is where normal program execution startsFor(F,-1,0) //The tricky bit. The first time the for loop loops, F=-1 and the if statement is true. Goto AIf F //Once the sub is executed, it reaches an End which it THINKS is the same end that ends the For loopGoto A //since the loop is still looping, control jumps [i]back into the for loop[/i]End //F is now 0 and the condition is false. Exit for loop :)
:ClrDraw:1→W:0→F:" →Str1:0→Xmin:0→Ymin:94→Xmax:62→Ymax:AxesOff:GridOff:While W=1:25→A:Text(‾1,0,10,"SPRITE-2-HEX:Text(25,25,"NEW SPRITE:Text(31,25,"EDIT SPRITE:Text(37,25,"ABOUT:Text(43,25,"QUIT:2→W:While W=2:Text(A,20,">:getKey→K:If max(K={25,34:Text(A,20," :A-6((K=25)(A>25)-(K=34)(A<43→A:If max(K={21,105:Then:If A=43:Then:DelVar ADelVar WDelVar KClrDraw:ClrHome:Return:End:If A=37:Then:ClrDraw:Text(‾1,0,10,"SRITE-2-HEX:Text(13,0,"THIS PROGRAM CONVERTS:Text(19,0,"8X8, 16X16, and 32X32:Text(25,0,"SPRITES INTO HEXADECIMAL:Text(31,0,"TO BE USED WITH THE:Text(37,0,"HEX-2-SPRITE PROGRAM.:Text(47,0,"SEND QUESTIONS TO::Text(53,0,"TIFREAK8XHOTMAIL.COM:Pause :ClrDraw:1→W:End:If A=31:Then:length(Str4:Ans/(2+2(Ans>16)+4(Ans>64:If min(Ans≠{8,16,32:Then:ClrDraw:Text(0,0,"NO SPRITE IN MEMORY:Pause :ClrDraw:1→W:End:If max(Ans={8,16,32:Then:ClrDraw→W:2→F:End:End:If A=25:Then:ClrDraw:Text(‾1,0,10,"SPRITE-2-HEX:Text(15,1,"PLEASE SELECT SPRITE SIZE:Text(30,25,"8X8:Text(36,25,"16X16:Text(42,25,"32X32:Text(48,25,"BACK:30→A:4→W:End:End:While W=4:Text(A,20,">:getKey→K:If max(K={25,34:Text(A,20," :A-6((K=25)(A>30)-(K=34)(A<48→A:If max(K={21,105:Then:If A=48:Then:ClrDraw:1→W:End:If A=30:8→Z:If A=36:16→Z:If A=42:32→Z:If A<48:3→W:End:End:While W=3:ClrDraw:If Z=8:Then:Line(40,31,40,38:Line(41,30,48,30:Line(49,31,49,38:Line(41,39,48,39:End:If Z=16:Then:Line(36,27,36,42:Line(37,26,52,26:Line(53,27,53,42:Line(37,43,52,43:End:If Z=32:Then:Line(28,19,28,50:Line(29,18,60,18:Line(61,19,61,50:Line(29,51,60,51:End:Horizontal(7:Text(56,0,"EXPORT QUIT:If F=2:Then:length(Str4:Ans/(2+2(Ans>16)+4(Ans>64→Z:If Z=8:Then:41→I:24→J:End:If Z=16:Then:37→I:20→J:End:If Z=32:Then:29→I:12→J:End:I→C:J→U:For(B,1,length(Str4:inString("123456789ABCDEF",sub(Str4,B,1:If 7<Ans:Pxl-On(U,C:If 3<8fPart(Ans/8:Pxl-On(U,C+1:If 1<4fPart(Ans/4:Pxl-On(U,C+2:If fPart(Ans/2:Pxl-On(U,C+3:C+4→C:U+(C=I+Z→U:If C=I+Z:I→C:End:End:45→M:35→N:6→W:StorePic Pic4:End:While W=6:Pt-Change(M,N:getKey→K:If max(K={24,25,26,34:Then:Pt-Off(M,N:RecallPic Pic4:M-(((K=24)((Z=8)(M>41)+(Z=16)(M>37)+(Z=32)(M>29))-((K=26)((Z=8)(M<48)+(Z=16)(M<52)+(Z=32)(M<60→M:N-(((K=34)((Z=8)(N>31)+(Z=16)(N>27)+(Z=32)(N>19))-((K=25)((Z=8)(N<38)+(Z=16)(N<42)+(Z=32)(N<50→N:End:If K=21:Then:RecallPic Pic4:Pt-On(M,N:StorePic Pic4:End:If K=31:Then:RecallPic Pic4:Pt-Off(M,N:StorePic Pic4:End:If K=15:Then:DelVar W:ClrDraw:ClrHome:End:If K=11:Then:Pt-Off(M,N:RecallPic Pic4:If Z=8:Then:41→S:48→T:24→Q:31→R:End:If Z=16:Then:37→S:52→T:20→Q:35→R:End:If Z=32:Then:29→S:60→T:12→Q:43→R:End:For(A,Q,R:For(B,S,T,4:8pxl-Test(A,B)+4pxl-Test(A,B+1)+2pxl-Test(A,B+2)+pxl-Test(A,B+3)→C:Pxl-On(A,B:If C=0:Str1+"0"→Str1:If C>0:Str1+sub("123456789ABCDEF",C,1)→Str1:End:End:sub(Str1,2,length(Str1)-1)→Str4:DelVar Str1:ClrDraw:Text(0,0,"YOUR SPRITE HAS BEEN:Text(6,0,"CONVERTED, PASTE Str4:Text(12,0,"INTO A PROGRAM TO USE:Pause :0→W:End:End:End:EndGenerated by SourceCoder, © 2005 Cemetech
I usually use Repeat loop to do these things
Code: [Select]Goto M //Start of Subroutine section. We want it to be at the top of the program, as all subroutines are accessed via lables //This code is skipped due to the Goto M statementLbl A //Subroutine ADisp "This is a fun sub"Disp "Its over 9000"EndLbl MDisp "Main program foo'!" //This is where normal program execution startsFor(F,-1,0 //The tricky bit. The first time the for loop loops, F=-1 and the if statement is true. Goto AIf F //Once the sub is executed, it reaches an End which it THINKS is the same end that ends the For loopGoto A //since the loop is still looping, control jumps [i]back into the for loop[/i]End //F is now 0 and the condition is false. Exit for loop :)
Goto M //Start of Subroutine section. We want it to be at the top of the program, as all subroutines are accessed via lables //This code is skipped due to the Goto M statementLbl A //Subroutine ADisp "This is a fun sub"Disp "Its over 9000"EndLbl MDisp "Main program foo'!" //This is where normal program execution startsFor(F,-1,0 //The tricky bit. The first time the for loop loops, F=-1 and the if statement is true. Goto AIf F //Once the sub is executed, it reaches an End which it THINKS is the same end that ends the For loopGoto A //since the loop is still looping, control jumps [i]back into the for loop[/i]End //F is now 0 and the condition is false. Exit for loop :)