rand^5+1->X
[0102030405]->L1
"ABCDEF"->Str1
3*x-2->Y
.perform Substring operation on array pointed to by Str1.
.Be careful to handle the case where the starting location is greater than 3, as will often happen if X can vary between 1 and 5
For(X,1,20)
End
.no need for ipart in Axe, since Decimals aren't supported.
5->A
And what is:
if X=1 and Y≥2:Then
end
Art_of_camelot:
I'll try it!
if X=1 and Y≥2:Then
End
would be
If X=1 and (Y≥2)
End
also use code tags [ code] [/ code] w/o the spacesFor future reference, you don't need to exclude spaces if you write it like this:
randInt(1,5)→XWoah, hold on there. This doesn't provide the same result as randInt(1,5), it provides the same result as max(1,randInt(0,5)). In other words, 1 is twice as likely as all the other numbers. What you want to use is this:
max(rand^6,1)→X
sub("ABCDEF",3X-2,3)→Str1Alright, let's see if I can whip up some code to do that:
Data(65,66,67,68,69,70)→Str1A // Note that 65 is the ASCII value for 'A', 66 for 'B', and so on.
Zeros(4)→Str1
For(A,0,3)
{3*X-3+A+Str1A}→{A+Str1}
End
BASIC | Axe | Notes | ||
randInt(1,5)→X | rand^5+1→X |
| ||
{1,2,3,4,5}→L₁ | Data(1,2,3,4,5)→GDB1 |
| ||
sub("ABCDEF",3X-2,3)→Str1 | sub(SUB,"ABCDEF",X*3-2,3)→S .Later in the code: Lbl SUB 0→{Copy(r₂+r₁-1,ᴇ8000,r₃)} Return ᴇ8000 |
| ||
iPart(X)+abs(Y)→Z | X+abs(Y)→Z |
| ||
For(X,1,20,1) End | For(X,1,20) End |
| ||
dim(L₁)→A | Data(1,2,3,4,5)→GDB1 []→GDB0 GDB0-GDB1→A |
|
:.FORCEATT
:ClrDraw
:Circle(15,15,10
:Circle(80,15,10
:Text(57,10,(„DEF“)
:Text(57,75,(“OFF”)
:Line(25,15,30,10
:Line(70,15,65,10
:Line(30,10,45,10
:Line(65,10,50,10
:Line(45,10,47,8
:Line(50,10,48,8
:Line(30,7,65,7
:Line(30,7,28,0
:Line(65,7,67,0
:Line(5,15,0,10
:Line(90,15,95,10
:rand^1+101→F
:For(U,1,F
:If U≥0 and (U≤9):-3→Q
:If U>99:3→Q
:If U≥10 and (U≤99):0→Q
:Text(-1,44,10-Q,U
:End
:rand^1+101→N
:For(U,1,N
:If U≥0 and (U≤9):-3→Q
:If U>99:3→Q
:If U≥10 and (U≤99):0→Q
:Text(-1,44,75-Q,U
:End
:Line(36,60,58,60
:Pt-On(35,62
:Pt-On(35,61
:Pt-On(59,62
:Pt-On(59,61
:Line(89,29,89,61
:Line(89,29,93,29
:Line(94,29,94,61
:Line(89,61,4,61
:Line(91,U,92,U
:Pause 5000
It should create a picture of a Card (ForceAttax - Don't think you know them)I did not know that yet.I'm not an Axe expert, but I think you forgot to put a few Ends in your code... In Axe, every If needs an End, even if there is no Else (and there is never an Else as far as I know).
PRGM after Error.
Thanks. Smiley
It's the Pt-ON( command.
Now, it says MISSING END
( after the Pause 5000 )
What should that be?
JosJuice is right: every If needs an EndOh sorry, I meant Then ;D
Josjuice is wrong: we can do Else
:.FORCEATT
:ClrDraw
:Circle(15,15,10
:Circle(80,15,10
:Text(57,10,(„DEF“)
:Text(57,75,(“OFF”)
:Line(25,15,30,10
:Line(70,15,65,10
:Line(30,10,45,10
:Line(65,10,50,10
:Line(45,10,47,8
:Line(50,10,48,8
:Line(30,7,65,7
:Line(30,7,28,0
:Line(65,7,67,0
:Line(5,15,0,10
:Line(90,15,95,10
:rand^1+101→F
:For(U,1,F
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Text(-1,44,10-Q,U
:End
:rand^1+101→N
:For(U,1,N
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Text(-1,44,75-Q,U
:End
:Line(36,60,58,60
:Pt-On(35,62
:Pt-On(35,61
:Pt-On(59,62
:Pt-On(59,61
:Line(89,29,89,61
:Line(89,29,93,29
:Line(94,29,94,61
:Line(89,61,4,61
:Line(91,U,92,U
:Pause 5000
Text(57,10,("DEF")
Must be
Text(10,57,"DEF")
Text(-1,X,Y
Must be
Fix 1
Text(X,Y
Fix 0
If you want to display the value of U, use
Text(X,Y,U>dec (Found via math-2)
Try it out and post the result.
:.FORCEATT
:ClrDraw
:Circle(15,15,10
:Circle(80,15,10
:Text(57,10,(„DEF“)
:Text(57,75,(“OFF”)
:Line(25,15,30,10
:Line(70,15,65,10
:Line(30,10,45,10
:Line(65,10,50,10
:Line(45,10,47,8
:Line(50,10,48,8
:Line(30,7,65,7
:Line(30,7,28,0
:Line(65,7,67,0
:Line(5,15,0,10
:Line(90,15,95,10
:rand^1+101→F
:For(U,1,F
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,10-Q,U▶Dec
:Fix 0
:End
:rand^1+101→N
:For(U,1,N
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,75-Q,U▶Dec
:Fix 0
:End
:Line(36,60,58,60
:Pt-On(35,62
:Pt-On(35,61
:Pt-On(59,62
:Pt-On(59,61
:Line(89,29,89,61
:Line(89,29,93,29
:Line(94,29,94,61
:Line(89,61,4,61
:Line(91,U,92,U
:Pause 5000
And also, you'll want a DispGraph at the end to display the buffer on the LCD.The lines are drawn on the buffer, and you have to copy it on the LCD, or you'll never see them.
Fix 5
at the start and a Fix 4
at the end of your program. Then you can use DispGraph to copy the buffer to the screen.
:.FORCEATT
:Fix 5
:ClrDraw
:DispGraph
:Circle(15,15,10
:Circle(80,15,10
:Text(57,10,("DEF")
:Text(57,75,("OFF")
:Line(25,15,30,10
:Line(70,15,65,10
:Line(30,10,45,10
:Line(65,10,50,10
:Line(45,10,47,8
:Line(50,10,48,8
:Line(30,7,65,7
:Line(30,7,28,0
:Line(65,7,67,0
:Line(5,15,0,10
:Line(90,15,95,10
:rand^1+101→F
:For(U,1,F
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,10-Q,U▶Dec
:Fix 0
:End
:rand^1+101→N
:For(U,1,N
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,75-Q,U▶Dec
:Fix 0
:End
:Line(36,60,58,60
:Pt-On(35,62
:Pt-On(35,61
:Pt-On(59,62
:Pt-On(59,61
:Line(89,29,89,61
:Line(89,29,93,29
:Line(94,29,94,61
:Line(89,61,4,61
:Line(91,U,92,U
:Pause 5000
:Fix 4
DispGraph
after the text drawing.
:.FORCEATT
:ClrDraw
:DispGraph
:Fix 5
:Circle(15,15,10
:Circle(80,15,10
:Text(57,10,("DEF")
:Text(57,75,("OFF")
:Line(25,15,30,10
:Line(70,15,65,10
:Line(30,10,45,10
:Line(65,10,50,10
:Line(45,10,47,8
:Line(50,10,48,8
:Line(30,7,65,7
:Line(30,7,28,0
:Line(65,7,67,0
:Line(5,15,0,10
:Line(90,15,95,10
:rand^1+101→F
:For(U,1,F
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,10-Q,U▶Dec
:Fix 0
:End
:rand^1+101→N
:For(U,1,N
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,75-Q,U▶Dec
:Fix 0
:End
:Line(36,60,58,60
:Pt-On(35,62
:Pt-On(35,61
:Pt-On(59,62
:Pt-On(59,61
:Line(89,29,89,61
:Line(89,29,93,29
:Line(94,29,94,61
:Line(89,61,4,61
:Line(91,U,92,U
:Pause 5000
:Fix 4
Yes. To display both text and lines, put aCode: [Select]Fix 5
at the start and aCode: [Select]Fix 4
at the end of your program. Then you can use DispGraph to copy the buffer to the screen.
I also think there are too much Fix. Try removing all the Fix0 and the Fix1 but letting the Fix5 and Fix4Thats not true. But ehm, Axe won't break on removing fixes, afaik...
Textmode must be in (" asfbhgdnjsghngbkgmjxsfghbdj ")
elsi it won't work with Axe.
Have you any idea why it isn't working?
of ralphdspam:I'm using 0.5.0
Which version of Axe are you using?
My first recommendation is to get the current version of Axe. (0.5.3 as of 6/16/11) (http://ourl.ca/4060)
I'm using 0.5.0
I've heard that this version needs it.
Fixed major bug with the Disp command when compiling for apps.
Fixed incorrect optimization with Dispgraph to other buffers.
Fixed the new numerical constants feature.
Fixed bug with nibble storing.
Fixed bug with big-endian storing.
I'm using 0.5.0Thats new for me. I used 0.5.0, and never needed it (and almost every prog has a bit text in it)
I've heard that this version needs it.
:For(U,1,Ftry:
:If U≥0 and (U≤9):-3→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):0→Q:End
:Fix 1
:Text(44,10-Q,U▶Dec
:Fix 0
:End
:For(U,1,F
:If U≥0 and (U≤9):0→Q:End
:If U>99:3→Q:End
:If U≥10 and (U≤99):3→Q:End
:Fix 1
:Text(44,10-3-Q,U▶Dec
:Fix 0
:End
Oooooh that makes a wave !!!Yes. Technically how signed numbers work is that the range of values 32768 to 65535 are considered to be -32768 to -1. So when you store -3 to Q, you're storing the unsigned value 65533. When you add or subtract that with another number, it acts like -3 (due to the limited range of 16-bit numbers)
Nevermind, did you try the solution of my previous post to replace the negative Q ?
@calc84maniac we can do -3→Q ?
ok, so it turns around, in factExactly. For more information on this number system, check out http://en.wikipedia.org/wiki/Two%27s_complement (http://en.wikipedia.org/wiki/Two%27s_complement)
0,1,2,3,4,...,65533,65534,65535,0,1,2,3,...
↑ -3
Is that it ?
You can use a negative 3. Signed $-3 is equal to unsigned $FFFD. Text( only displays unsigned variables.Actually, you must use the normal multiplication (it works because it's so closely related to addition/subtraction). In Axe, ** is something different entirely called fixed-point multiplication.
You can use addition and subtraction with signed integers. For division and multiplication, you must use ** or // respectively. For comparisons, you also use doubled operators.
With this knowledge, you can write a routine that can display signed variables.
:.FORCEATT
:Fix 5
:ClrDraw:DispGraph
:Circle(15,15,10
:Circle(80,15,10:Text(57,10,("DEF")
:Text(57,75,("OFF")
:Text(10,57,"DEF
:Text(75,57,"OFF
:Line(25,15,30,10
:Line(70,15,65,10
:Line(30,10,45,10
:Line(65,10,50,10
:Line(45,10,47,8
:Line(50,10,48,8
:Line(30,7,65,7
:Line(30,7,28,0
:Line(65,7,67,0
:Line(5,15,0,10
:Line(90,15,95,10
:DispGraph
:rand^1+101→F
:For(U,1,F
:If U≥0 and (U≤9):-3→Q
:0→Q
:End
:If U>99:3→Q
:6→Q
:End
:If U≥10 and (U≤99):0→Q
:3→Q
:End
:Fix 1:Text(44,10-Q,U▶Dec
:Text(10-3-Q,44,U▶Dec
:DispGraph
:Fix 0
:End
:rand^1+101→N
:For(U,1,N
:If U≥0 and (U≤9):-3→Q
0→Q
:End
:If U>99:3→Q
:6→Q
:End
:If U≥10 and (U≤99):0→Q
:3→Q
:End
:Fix 1:Text(44,75-Q,U▶Dec
:Text(75-3-Q,44,U▶Dec
:DispGraph
:Fix 0
:End
:Line(36,60,58,60:Pt-On(35,62
:Pt-On(35,61
:Pt-On(59,62
:Pt-On(59,61
:Pxl-On(35,62
:Pxl-On(35,61
:Pxl-On(59,62
:Pxl-On(59,61
:Line(89,29,89,61
:Line(89,29,93,29
:Line(94,29,94,61
:Line(89,61,4,61
:Line(91,U,92,U
:DispGraph
:Pause 5000
:Fix 4
of Hayleia:To change between pxl and Point::Pt-On(35,62:Pt-On(35,61:Pt-On(59,62:Pt-On(59,61
:Pxl-On(35,62
:Pxl-On(35,61
:Pxl-On(59,62
:Pxl-On(59,61
I think it would be better to delete everything after theIf you want, it is your prog, after all.
:For(U,1,N
.......
:End
(but not the pause and the fix)
But why are the circles opened at the right side?I think it is because of the displayed numbers, they erase the circle
How should I writeYou do
:Repeat getKey=105:End
in Axe code?
:.FORCEATT
:Fix 5
:ClrDraw
:Text(57,10,"DEF
:Text(57,75,"OFF
:Text(45,57,"p2
:Circle(15,47,10
:Circle(80,47,10
:Line(25,47,30,52
:Line(70,47,65,52
:Line(30,52,45,52
:Line(65,52,50,52
:Line:45,52,47,54
:Line(50,52,48,54
:Line(30,55,65,55
:Line(30,55,28,62
:Line(65,55,67,62
:Line(5,47,0,52
:Line(90,47,95,52
:DispGraph
:rand^100+1→F
:For(U,1,F
:If U≥0 and (U≤9)
:13→Q
:End
:If U≥10 and (U≤99)
:10→Q
:End
:If U>99
:7→Q
:End
:Fix 1
:Text(Q,44,U▶Dec
:Circle(15,47,10
:Line(25,47,30,52
:DispGraph
:Fix 0
:End
:rand^100+1→N
:For(U,1,N
:If U>99
:72→Q
:End
:If U≥0 and (U≤9)
:78→Q
:End
:If U≥10 and (U≤99)
:75→Q
:End
:Fix 1
:Text(Q,44,U▶Dec
:Circle(80,47,10
:Line(90,47,95,52
:DispGraph
:Fix 0
:End
:DispGraph
:Pause 25000
:Fix 4
:.FORCEATT
:Fix 5
:LöscheBild
:Text(57,10,"DEF
:Text(57,75,"OFF
:Text(45,57,"p2
:Kreis(15,47,10
:Kreis(80,47,10
:Strecke(25,47,30,52
:Strecke(70,47,65,52
:Strecke(30,52,45,52
:Strecke(65,52,50,52
:Strecke(45,52,47,54
:Strecke(50,52,48,54
:Strecke(30,55,65,55
:Strecke(30,55,28,62
:Strecke(65,55,67,62
:Strecke(5,47,0,52
:Strecke(90,47,95,52
:Anz. Graf.
:Zufall^100+1→F
:For(U,1,F
:If U≥0 und (U≤9)
:13→Q
:End
:If U≥10 und (U≤99)
:10→Q
:End
:If U>99
:7→Q
:End
:Fix 1
:Text(Q,44,U▶Dez
:Kreis(15,47,10
:Strecke(25,47,30,52
:Anz. Graf.
:Fix 0
:End
:Zufall^100+1→N
:For(U,1,N
:If U>99
:72→Q
:End
:If U≥0 und (U≤9)
:78→Q
:End
:If U≥10 und (U≤99)
:75→Q
:End
:Fix 1
:Text(Q,44,U▶Dez
:Kreis(80,47,10
:Strecke(90,47,95,52
:Anz. Graf.
:Fix 0
:End
:Anz. Graf.
:Pause 25000
:Fix 4
sweet. :DMzking him wave his arms is impossible: it is a card.
Try to make him waving with his arms.
shell i send you a few pictures of the fpa-man? (as a PM)
The HERO is not exactli in the mid of the screen.
The HERO is not exactli in the mid of the screen.
Because of the "FPA", I like it this way. Nice!
GetCalc("appvXXX",size)->Pointer
Copy(Pointer_to_pic, Pointer_to_appvar, Size_of_pic_bytes)
No Ashbad you're not a lobster, Netham45 is one and is immune to losing the game