Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Munchor on November 06, 2010, 12:00:13 pm

Title: [Axe]Title Screen
Post by: Munchor on November 06, 2010, 12:00:13 pm
Hey everyone, I have small knwoledge on axe and would like to know how to make a VERY SIMPLE title screen.

Can I use the same menus as in TI BASIC:

Code: [Select]
Menu("Choose","Play",1,"About",2,"Quit",3)
or

Code: [Select]
:ClrHome
:AxesOff
:ClrDraw
:1?W
:While W
:While W=1
:Text(1,1,"CHOOSE FORMULA
:Text(7,1,"1:CIRCLE AREA
:Text(14,1,"2:SPHERE VOL.
:Text(21,1,"3:CYLINDER VOL.
:Text(28,1,"4:CONE VOL.
:Text(35,1,"5:CONE SURFACE AREA
:Text(42,1,"6:QUADR. PYR. VOL.
:Text(49,1,"7:CYLINDER SURFACE AREA
:Text(56,1,"8:MORE FORMULAS
:Repeat 2>abs(5-abs(5-abs(Ans-83
:getKey
:End
:Ans?K
:If K=73
:Then
:ClrDraw
:2?W
:Else
:If K=92
:Then
:ClrHome
:Prompt R
:Output(4,2,"VOLUME IS:":Output(5,2,RRp
:End
:If K=93
:Then
(...)


Thanks
Title: Re: [Axe]Title Screen
Post by: Raylin on November 06, 2010, 12:11:02 pm
Menu() is the correct command if you want a simple title screen.
Make sure your labels match when you use it though.
Title: Re: [Axe]Title Screen
Post by: squidgetx on November 06, 2010, 12:12:17 pm
Menu() is the correct command if you want a simple title screen.
Make sure your labels match when you use it though.

I think he wants to know how to do it in Axe. (Axe doesn't support Menu(), does it?)
Title: Re: [Axe]Title Screen
Post by: Raylin on November 06, 2010, 12:15:10 pm
Oh. It just said Title Screen. My fault.
If you want a menu in Axe, you'll have to hand make it and handle all input.
Axe doesn't handle anything on its own in regards to input or a native Menu() command.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 06, 2010, 12:41:27 pm
Code: [Select]
:ClrHome
:AxesOff
:ClrDraw
:1?W
:While W
:While W=1
:Text(1,1,"CHOOSE FORMULA
:Text(7,1,"1:CIRCLE AREA
:Text(14,1,"2:SPHERE VOL.
:Text(21,1,"3:CYLINDER VOL.
:Text(28,1,"4:CONE VOL.
:Text(35,1,"5:CONE SURFACE AREA
:Text(42,1,"6:QUADR. PYR. VOL.
:Text(49,1,"7:CYLINDER SURFACE AREA
:Text(56,1,"8:MORE FORMULAS
:Repeat 2>abs(5-abs(5-abs(Ans-83
:getKey
:End
:Ans?K
:If K=73
:Then
:ClrDraw
:2?W
:Else
:If K=92
:Then
:ClrHome
:Prompt R
:Output(4,2,"VOLUME IS:":Output(5,2,RRp
:End
:If K=93
:Then
(...)

Something like that would work?
Title: Re: [Axe]Title Screen
Post by: Raylin on November 06, 2010, 12:57:05 pm
Something like that.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 06, 2010, 01:18:27 pm
Something like that.

K, I'll try it.

BTW:

Code: [Select]
:.VIRUS
:ClrHome
:For(A,1,9999
:Pause 9999
:Pause 9999
:Pause 9999
:Pause 9999

Would this work as a successful virus in Axe?

I can't try it in my calculator, though

It doesn't work in the ROM: error: Block
Title: Re: [Axe]Title Screen
Post by: Builderboy on November 06, 2010, 01:23:21 pm
this would be more effective

Code: [Select]
.Axe
While 1
End

Impossible for the user to break out of without pulling the battery.  That, or

Code: [Select]
.Axe
Asm(C7)

Just shuts down the calc and resets ram, pretty much what you are going for
Title: Re: [Axe]Title Screen
Post by: Aichi on November 06, 2010, 01:24:11 pm
This code works while you add a new line with 'end', since youre use For.
Also, it isnt very fun, if you let execute this by someone who have important things in the RAM and doesnt know that  he has just to wait.
Title: Re: [Axe]Title Screen
Post by: alberthrocks on November 06, 2010, 01:28:04 pm
Be sure to flip X and Y. For instance:
Code: [Select]
:Text(1,14,"2:SPHERE VOL.instead of the original
Code: [Select]
:Text(14,1,"2:SPHERE VOL.In Axe, it's Text(X,Y, "text here"), not weird TI's Text(Y,X, "text here"). :)

Also, Prompt will not work. It's not an implemented command yet. Input is there, but it has yet to be seen if it will work or not. (on 2.53MP) Syntax IIRC is:
Code: [Select]
input->Str0...or whatever variable you wish to use :)

Then is not used at all with Ifs. You can simply remove them.

Finally, your keycodes are invalid - the one Axe uses is Xlib ones. The plus side though is that you can have multiple keys with:
Code: [Select]
If getKey(1) and getKey(2)
Here's a really simple key ref program. Just compile and run! :)
Code: [Select]
.AXEKEYF Axe key finder
ClrHome

0->Z
0->Q
Text(0,0,"Axe Key Finder v1.0")
Text(0,0,"--------------------")
Text(0,57,"(C) Albert H. - Axe by Quigbo")
Text(0,12,"Key:")
While Q!=1 (this is the does not equal to sign, not a ! and a =)
getKey->Z
If Z!=0
Text(14,12,"                ")
Text(14,12,Z>Dec)

If Z=15

If Q=2
1->Q
End

If Q=0
Text(0,24,"Press CLEAR again to exit.")
2->Q
End

Else
Text(0,24,"                                                                                            ")
0->Q
End

End

End
ClrHome

Have fun in Axe! :) It does take some guts to break some old BASIC habits, but once you're in, you'll have a LOT of fun! :D
Title: Re: [Axe]Title Screen
Post by: DJ Omnimaga on November 07, 2010, 01:17:25 am
About viruses, I would avoid using them maliciously except maybe if someone did lot of trouble to you or something :P, but even then it isn't a really good practice. :P

And yeah it took me a while to break some habits I had, especially using Output(0,0 instead of Output(1,1, not updating the screen every frame or locking myself inside endless loops X.x.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 09:27:42 am
I can make a menu, my doubts is the GetKey, that's what I need to learn: getkeys, have no idea of how to use them :S

(http://img577.imageshack.us/img577/4858/keycodes.png)

I know these are the keys, but I can't make getkeys :S
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 09:37:49 am
Code: [Select]
ClrHome
Disp "Menu" ,i, "1) Start" ,i, "2) Options" ,i, "3) Help" ,i, "4) About" ,i, "5) Exit"
Repeat G=27
getkey->G
If G=34
sub(S)
End
If G=26
sub(O)
End
If G=18
sub(H)
End
If G= 35
sub(A)
End
End
ClrHome

What about reading the documentation and the commands list?
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 09:54:29 am
Thanks everyone, I'm getting some success:

Code: [Select]
ClrDraw
ClrHome
Text(0,0,"Title
Text(0,10,"1:Play
Text(0,20,"2:About
Text(0,30,"3:Help
Text(0,40,"4:Quit
getkey->Z
If G=34
// CODE FOR GAME
End
If G=26
ClrHome
Disp "GAME BY DAVID"
End
If G=18
Disp "HELP ..."
End
If G=35
Stop

What do you think
Title: Re: [Axe]Title Screen
Post by: DJ Omnimaga on November 07, 2010, 01:17:26 pm
To use Getkey, for example,

Repeat getkey(15)
End

would cause a loop until you press key #15, which happens to be CLEAR. Getkey=15 also works, but it is not as responsive, although it is more like the TI-OS getkey, so it's easier to navigate menus.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 01:19:23 pm
To use Getkey, for example,

Repeat getkey(15)
End

would cause a loop until you press key #15, which happens to be CLEAR. Getkey=15 also works, but it is not as responsive, although it is more like the TI-OS getkey, so it's easier to navigate menus.

Great help thanks!

I have a BLOCK Error now, what kind of errors could be block erros...

Since 90% is compiled before the error, that means the error is in the end?
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 01:23:53 pm
Probably there are too much Ends in the code.
The number of Ifs/Repeats and the number of Ends should be the same.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 01:26:41 pm
Probably there are too much Ends in the code.
The number of Ifs/Repeats and the number of Ends should be the same.

Thanks, I'll check that, the Axe Compiler should really tell us the line :S

EDIT: THAT WORKED! Now, I have a Titlte Screen, but it disappears right after, I don't want Pauses to make it stay there. Alternatives?
Title: Re: [Axe]Title Screen
Post by: DJ Omnimaga on November 07, 2010, 01:27:17 pm
Yeah I wish it did. Hopefully in the final version he will.
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 01:28:25 pm
@Scoutdavid
Did you tried to press PRGM while Axe output the error?
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 01:29:38 pm
@Scoutdavid
Did you tried to press PRGM while Axe output the error?

No, I didn't. What would that do?

Now, I have a Titlte Screen, but it disappears right after, I don't want Pauses to make it stay there. Alternatives?
Title: Re: [Axe]Title Screen
Post by: Happybobjr on November 07, 2010, 01:30:22 pm
it scrolls to the error

Edit: make sure you have... in your code.. in that order


.....
Dispgraph
Cleardraw.
.......
Title: Re: [Axe]Title Screen
Post by: aeTIos on November 07, 2010, 01:30:30 pm
that will make you go to the error that is specified
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 01:30:56 pm
that will make you go to the error that is specified

Great, no idea lol, thansk much, now it'll all be easier

Now, I have a Titlte Screen, but it disappears right after, I don't want Pauses to make it stay there. Alternatives?
Title: Re: [Axe]Title Screen
Post by: aeTIos on November 07, 2010, 01:32:30 pm
:repeat getKey
:end

does the same thing as pause in basic
I mean, it waits for a key
if you want enter to be pressed, do this:
:repeat getKey(9)
:end
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 01:43:35 pm
My code:

Code: [Select]
:ClrHome
:ClrDraw
:Text(0,0,"TITLE
:Text(10,0,"1:Play
:Text(20,0,"2:About
:Text(30,0,"3:Help
:Text(40,0,"4:Quit
:getKey->Z
:If Z = 26
:Disp "BY DAVID
End
:If Z=18
:Disp "Help"
:End
:If Z=35
:Disp "Quit Program Code
:End
:If Z=34
// CODE FOR THE GAME
:End

how to make the title screen show up and I can choose keys from 1 to 4 and then do what the code here tells to do, I'm having some difficulties with the easiest part I guess :S
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 01:45:26 pm
You should put the key test in a loop, as it was said here already two times.
Title: Re: [Axe]Title Screen
Post by: DJ Omnimaga on November 07, 2010, 01:46:06 pm
it scrolls to the error

Edit: make sure you have... in your code.. in that order


.....
Dispgraph
Cleardraw.
.......
Oh wait I forgot Axe still had error scrolling. I thought it was removed because it caused crashes and stuff in earlier versions of Axe, especially with archived files.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 01:49:15 pm
You should put the key test in a loop, as it was said here already two times.

I tried Repeat getKey->Z

and it didn't work :S
Title: Re: [Axe]Title Screen
Post by: DJ Omnimaga on November 07, 2010, 01:52:14 pm
as it was said here already two times.
I don't see where it was said ???
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 01:54:01 pm
Code: [Select]
:ClrHome
:ClrDraw
:Text(0,0,"TITLE
:Text(10,0,"1:Play
:Text(20,0,"2:About
:Text(30,0,"3:Help
:Text(40,0,"4:Quit
:Repeat getKey->Z
:If Z = 26
:Disp "BY DAVID
End
:If Z=18
:Disp "Help"
sub(PAU)
:End
:If Z=35
:Disp "Quit Program Code
sub(PAU)
:End
:If Z=34
// CODE FOR THE GAME
sub(PAU)
:End

Lbl PAU
Repeat getkey->A
End
Return
Title: Re: [Axe]Title Screen
Post by: aeTIos on November 07, 2010, 01:54:10 pm
Code: [Select]
:.(GAMENAME)
:Lbl 1
:ClrHome
:ClrDraw
:Text(0,0,"TITLE
:Text(10,0,"1:Play
:Text(20,0,"2:About
:Text(30,0,"3:Help
:Text(40,0,"4:Quit
:Repeat getKey->Z
:End
:If Z = 26
:ClrHome
:Disp "BY DAVID
:Repeat getKey
:End
:Goto 1
:End
:If Z=18
:ClrHome
:Disp "Help"
:Repeat getKey
:End
:Goto 1
:End
:If Z=35
:ClrHome
:Disp "Quit Program Code
:Repeat getKey
:End
:Goto 1
:End
:If Z=34
// CODE FOR THE GAME
:End

BTW, you'd better use Output( instead of Disp.
If you use Disp multiple times in one part of code, like
Code: [Select]
...
:Disp "1"
:Disp "2"
then all text will be displayed in one line so you get  "    1     2"

But, thats all yours. with this code, it would work

EDIT: ninja'd
:D

Aichi, your use of a sub is very good, but you dont have to use
Code: [Select]
0->A
Repeat getKey->A
End
just use
Code: [Select]
Repeat getKey
End
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 02:02:12 pm
as it was said here already two times.
I don't see where it was said ???
There are some mentions on page 1, for example from you.
Also, sorry if this part of my post was impolite. <.<

Edit @ aeTIos:
Hm, I think it has to be Repeat->Variable, else the previous keypress would not be ignored.

Edit²:
I mean Repeat getkey->Variable of course. :D
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 02:08:00 pm
BTW, how do I make the sub? Using Alpha Low.Case?
Title: Re: [Axe]Title Screen
Post by: aeTIos on November 07, 2010, 02:08:35 pm
you create a sub by [2nd][0][T][up][up][enter]
the 3 letters is the label you want to be "subbed" ;)
in games, you can use a sub when you use a specific routine very much
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 02:09:03 pm
[2ND] [ 0]  [T] [Up] [Up] - Token

Edit @ aeTIos:
If someone go to the help menu for example, by pressing 1. Repeat getkey (This one in the help menu) will be true via the key 1, which is still pressed.
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 02:15:55 pm
Code: [Select]
:.(GAMENAME)
:Lbl 1
:ClrHome
:ClrDraw
:Text(0,0,"TITLE
:Text(10,0,"1:Play
:Text(20,0,"2:About
:Text(30,0,"3:Help
:Text(40,0,"4:Quit
:Repeat getKey->Z
:End
:If Z = 26
:ClrHome
:Disp "BY DAVID
:Repeat getKey
:End
:Goto 1
:End
:If Z=18
:ClrHome
:Disp "Help"
:Repeat getKey
:End
:Goto 1
:End
:If Z=35
:ClrHome
:Disp "Quit Program Code
:Repeat getKey
:End
:Goto 1
:End
:If Z=34
// CODE FOR THE GAME
:End

Gives me no errors, but the menu opens white and then when I press any key, the screen appears for a mili second and disappears again :(
Title: Re: [Axe]Title Screen
Post by: Aichi on November 07, 2010, 02:18:26 pm
Code: [Select]
:.(GAMENAME)
:Lbl 1
:ClrHome
:ClrDraw
:Text(0,0,"TITLE
:Text(10,0,"1:Play
:Text(20,0,"2:About
:Text(30,0,"3:Help
:Text(40,0,"4:Quit
:Repeat getKey->Z
:End
:If Z = 26
:ClrHome
:Disp "BY DAVID
:Repeat getKey
:End
:Goto 1
:End
:If Z=18
:ClrHome
:Disp "Help"
:Repeat getKey
:End
:Goto 1
:End
:If Z=35
:ClrHome
:Disp "Quit Program Code
:Repeat getKey
:End
:Goto 1
:End
:If Z=34
// CODE FOR THE GAME
:End

Gives me no errors, but the menu opens white and then when I press any key, the screen appears for a mili second and disappears again :(

D:
Put the End (this one after the Repeat start) into the last line.
Edit: After the repeat getkey->z
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 02:24:06 pm
Code: [Select]
:.(GAMENAME)
:Lbl 1
:ClrHome
:ClrDraw
:Text(0,0,"TITLE
:Text(10,0,"1:Play
:Text(20,0,"2:About
:Text(30,0,"3:Help
:Text(40,0,"4:Quit
:Repeat getKey->Z
:End
:If Z = 26
:ClrHome
:Disp "BY DAVID
:Repeat getKey
:End
:Goto 1
:End
:If Z=18
:ClrHome
:Disp "Help"
:Repeat getKey
:End
:Goto 1
:End
:If Z=35
:ClrHome
:Disp "Quit Program Code
:Repeat getKey
:End
:Goto 1
:End
:If Z=34
// CODE FOR THE GAME
:End

Gives me no errors, but the menu opens white and then when I press any key, the screen appears for a mili second and disappears again :(

D:
Put the End (this one after the Repeat start) into the last line.
Edit: After the repeat getkey->z

There is an end after the getKey->Z and I did put it, though :S
Title: Re: [Axe]Title Screen
Post by: Builderboy on November 07, 2010, 02:26:51 pm
Hmmm thats strange, is this your full code or do you have more that is part of a larger program?
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 02:28:45 pm
Hmmm thats strange, is this your full code or do you have more that is part of a larger program?

Yes, I have, I'll start a new thread about it with the whole code
Title: Re: [Axe]Title Screen
Post by: Builderboy on November 07, 2010, 02:29:20 pm
You have a Fix 5 somewhere in there don't you?
Title: Re: [Axe]Title Screen
Post by: DJ Omnimaga on November 07, 2010, 02:35:09 pm
as it was said here already two times.
I don't see where it was said ???
There are some mentions on page 1, for example from you.
Also, sorry if this part of my post was impolite. <.<

Edit @ aeTIos:
Hm, I think it has to be Repeat->Variable, else the previous keypress would not be ignored.

Edit²:
I mean Repeat getkey->Variable of course. :D
Ah ok because the two posts in question seemed to talk about Repeat but for a different matter. X.x
Title: Re: [Axe]Title Screen
Post by: Munchor on November 07, 2010, 02:36:43 pm
You have a Fix 5 somewhere in there don't you?

Yes I do, I found a way to fix it.

Omg, are you a witch or something?
Title: Re: [Axe]Title Screen
Post by: Builderboy on November 07, 2010, 02:38:27 pm
Haha nope but i saw that the only way that you could possible not be seeing  something with that code is if those text commands were drawing to the buffer instead of the screen, and the only way that can happen if if you had a Fix 5 somewhere in the code :)

Its not witchcraft is merely the power of deduction! ;D Glad you got it to work too :)