0 Members and 2 Guests are viewing this topic.
whoa, why does the Circle one work?An efficient way to jump without Goto:Code: [Select]:Delvar KRepeat K=21:<stuff>:Repeat K=21 or K=105:getkey->K:End:Endthis is useful for when you want a back and a go on option. of course you can replace the keycodes and stuff though.
:Delvar KRepeat K=21:<stuff>:Repeat K=21 or K=105:getkey->K:End:End
DelVar KRepeat K=21\\code\\Repeat 42=abs(K-63getKey→KEndEnd
What do you mean by loop control statement in the middle of a line? Could you show a good and bad code example?
:DelVar AIf A:Return
:DelVar A:If A:Return
If K=1 or K=2 or K=3 or K=4 or K=5\Do something.\
If max(K={1,2,3,4,5\Do something.\
If K=21 or K=105\Do something.\
If 42=abs(K-63\Do something.\
X+(K=26)-(K=24 Ans-(Ans=17)+not(Ans→XY+(K=34)-(K=25Ans-(Ans=9)+not(Ans→Y
min(16,max(1,X+sum(⌂List(K={24,26→Xmin(8,max(1,Y+sum(⌂List(K={25,34→Y
31(A>1)+31(A>2)+31(A>3)+31(A>4
31sum(A>{1,2,3,4
0For(A,1,dim(L1Ans+(C=L1(AEndIf Ans\Do something.\
If max(C=L1\Do something.\
Code: [Select]If K=1 or K=2 or K=3 or K=4 or K=5\Do something.\Can be...Code: [Select]If max(K={1,2,3,4,5\Do something.\(Not mine, I think I saw Nemo do it first but I don't know if it predates him doing it where I saw.)Code: [Select]If K=21 or K=105\Do something.\Can be...Code: [Select]If 42=abs(K-63\Do something.\However this one does not always work. You have to test and make sure. The basic algorithm to figure out the numbers is (Keycode #1+Keycode #2)/2 and that will give you the number to subtract by. Then you just subtract one of the keycodes by it and it will give you the number that they will equal. (Example: 105+21=126/2=63 then 105-63=42 and 21-63=-42 which |-42|=42). (I don't take credit for this optimization. It's Ztrumpet's as far as I know.)
Code: [Select]X+(K=26)-(K=24 Ans-(Ans=17)+not(Ans→XY+(K=34)-(K=25Ans-(Ans=9)+not(Ans→YCan be...Code: [Select]min(16,max(1,X+sum(⌂List(K={24,26→Xmin(8,max(1,Y+sum(⌂List(K={25,34→Y(Not sure who I saw this from but it was a while ago but calc84maniac talked about this method a few weeks ago on HCWP.)
Here is the complete testing code::startTmr:Repeat startTmr=Ans+1 ;this is to ensure that the test starts exactly on a second, not halfway through:End:startTmr->A:For(B,1,6000:<Code goes here>:End:Disp checkTmr(A
Wow nice tricks guys. One thing about Meishe's tricks, though: weren't those slower?