Author Topic: Simplest menu needed  (Read 7608 times)

0 Members and 1 Guest are viewing this topic.

Offline Piguy-3.14

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +1/-0
    • View Profile
Simplest menu needed
« on: June 17, 2013, 08:16:07 pm »
Does anyone have a EXTREMELY SIMPLE code for creating a menu in axe? If so post it here, as I need a code for a menu that can be used for an inventory for selecting blocks. The only thing if must have is the ability to be scrollable, as I need a menu to support many different objects to choose from. Like I said all I need is a simple code for creating a scrollable menu that allows you to choose from a large selection of objects. I would prefer one that at least uses the arrow keys to scroll up and down and select a highlighted part. But if that requires a lot of code than a simple one that displays a number by each object and uses getKey and that number to select a command. If you have a code for a SIMPLE menu please show me it.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Simplest menu needed
« Reply #1 on: June 17, 2013, 09:39:38 pm »
the actual code depends on what you want your menu to do. should it take up the whole screen? should it only show up on a smaller section? should it scroll smoothly? should the selector move or stay in place?

you'll be a lot better off if you write the code yourself, as you can choose exactly how you want it to look and you'll end up learning things in the process that you'll absolutely need when writing anything more complex. the basic idea, though, is to have a list of names. if you want the selector to be able to move on its own, you will then need two values, one for indicating the offset to the first item that's on the screen and one indicating the current position of the selector. then adding those two values together will give you the offset in the list to the currently hilit menu option. if you want the selector to be stationary and have the menu options scroll behind it, then you only need one indicator, the offset of the item currently hilit.

i know that may sound a bit complex, but if you can't figure that much out on your own you'll have a very hard time writing anything substantial, so give it your best shot =)

Offline Piguy-3.14

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +1/-0
    • View Profile
Re: Simplest menu needed
« Reply #2 on: June 17, 2013, 10:34:04 pm »
I really just want a code, am good with axe, but menus are just not my strength(I'm used to the menu command in basic), so I just want a code, as I want to spend more time on the game itself rather than making a menu that most people won't even pay attention to if you know what I mean. Thanks anyway.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Simplest menu needed
« Reply #3 on: June 18, 2013, 01:12:27 am »
I already gave you a code on Cemetech that produces a menu similar to the ones you use in Basic. I copy-paste it here if you want.
The only thing that interests you is the MENU routine (and the CursorForMENU routine that is needed for the first one to work), the rest being some example code to show you how to make it work.

Where in Basic you would have written this line:

:Menu("TITLE","OPTION_1",Label_1,"OPTION_2",Label2,...,"OPTION_N",Label_N)

Just write those two lines in your Axe code:

:MENU("TITLE"[00]"OPTION_1"[00]"OPTION_2"[00]..."OPTION_N"[00][25])
:Z-Test(,Label1,Label2,...,LabelN)

Now the code in itself:
Code: [Select]
.MENU

.###########################
. PRELIMINARY COMMANDS
.###########################

Fix 5
ClrDraw

.###########################
. MAIN CODE
.###########################

MENU("TITLE"[00]"OPTION_1"[00]"OPTION_2"[00]"OPTION_3"[00]"OPTION_4"[00]"OPTION_5"[00][25])
Z-Test(,Label1,Label2,Label3,Label4,Label5)

Lbl Label1
Text(0,,"THIS IS THE LABEL 1")
DispGraph
Pause 3600
Return

Lbl Label2
Text(0,,"THIS IS THE LABEL 2")
DispGraph
Pause 3600
Return

Lbl Label3
Text(0,,"THIS IS THE LABEL 3")
DispGraph
Pause 3600
Return

Lbl Label4
Text(0,,"THIS IS THE LABEL 4")
DispGraph
Pause 3600
Return

Lbl Label5
Text(0,,"THIS IS THE LABEL 5")
DispGraph
Pause 3600
Return

.###########################
. SUBROUTINES
.###########################

Lbl MENU
Text(0->r3->r2,,r1)
While 1
End!If {stdDev(r1,r2++)}-37
RectI(0,,96,6)
For(r2--)
 Text(0,r3++*6,r3>Dec)
 {|E86D7}-2->{|E86D7}
 Text ": "
 Text stdDev(r1,r3)
End
0->r1
While 1
 r1+getKey(1)-getKey(4)+r2^r2->r1
 CursorForMENU()
 DispGraph
 Pause 200
 CursorForMENU()
EndIf getKey(9)
Returnr1

Lbl CursorForMENU
RectI(0,r1+1*6,6,)
Return
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Piguy-3.14

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +1/-0
    • View Profile
Re: Simplest menu needed
« Reply #4 on: June 18, 2013, 09:04:47 am »
Okay I will see if this works for my game, the reason I didn't use it last time is because I didn't exactly need it yet and I guess I forgot it was there, thanks.

Edit* one q how do you get the | character? I cannot find it anywhere... Please tell me!!! Also am I supposed to type CursorforMENU??? As I am not sure..

Also the line Text(0,r3++*6,r3>Dec) gives me an invalid token error

The point is this menu is not working, I keep getting errors for some reason... And is this really what is considered a simple menu in axe lol, if so I really think Runer112 should work on adding a menu command like in basic for people who do not care how ugly or stupid their menu looks, as if I have to do this just to make a simple menu, that's a little rediculous*sigh*
« Last Edit: June 18, 2013, 02:42:35 pm by Piguy-3.14 »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Simplest menu needed
« Reply #5 on: June 18, 2013, 04:27:05 pm »
The >Dec is not a ">" followed by "D" then "e" then "c" but the token you can find in the Maths menu when editing an Axe program (the second token in the list).
Sorry, I used TokenIDE to write and test that code so I did not have it written as "►Dec".
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Piguy-3.14

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +1/-0
    • View Profile
Re: Simplest menu needed
« Reply #6 on: June 18, 2013, 04:41:45 pm »
I did use the Dec token, it says the error is in the Text( command...

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Simplest menu needed
« Reply #7 on: June 18, 2013, 04:44:23 pm »
And is "r3" the token you find in "Vars", "Left", "3", "3" and not just a "r" before a "3" ?
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Piguy-3.14

  • LV3 Member (Next: 100)
  • ***
  • Posts: 41
  • Rating: +1/-0
    • View Profile
Re: Simplest menu needed
« Reply #8 on: June 18, 2013, 04:50:31 pm »
Yes it is the one located under vars polar that I used, still invalid token on Text( for some reason
How do you get the | symbol that may be what's causing the error

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Simplest menu needed
« Reply #9 on: June 19, 2013, 01:18:30 am »
Ah, the "|E" is not a "|" followed by a "E", but the small uppercase "E" you find with [2nd]+[,]
« Last Edit: June 19, 2013, 01:18:44 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Simplest menu needed
« Reply #10 on: June 19, 2013, 03:12:19 am »
I agree with Shmibs. Making menus in any language should be fairly simple. Many of us even created custom menus in TI-BASIC simply because we didn't like the look of the built in ones or wanted it to look/act a specific way. You can always ask questions if you get stuck on something.

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Simplest menu needed
« Reply #11 on: June 19, 2013, 03:21:13 am »
Especially in Axe, though, some really impressive menus can be made, if some time and effort is put into it. For instance, this one here:

(cue comments that the fire thing is overused by now :P )

In any case, I can see that that might be unsuitable for an inventory screen, but deviating from the standard OS menu is likely a good idea in this case. For instance, using 5*3 font instead of the 7*5 would allow you to have more menu items available on the screen at a time ;)
« Last Edit: June 19, 2013, 03:21:24 am by turiqwalrus »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Simplest menu needed
« Reply #12 on: June 19, 2013, 03:22:38 am »
in this case. For instance, using 5*3 font instead of the 7*5 would allow you to have more menu items available on the screen at a time ;)

^Yupp, exactly this. :)

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Simplest menu needed
« Reply #13 on: June 19, 2013, 03:24:08 am »
Plus, it encourages you to experiment and get more used to Axe. All in all, a win-win situation.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Simplest menu needed
« Reply #14 on: June 20, 2013, 04:45:39 am »
I agree with Shmibs. Making menus in any language should be fairly simple. Many of us even created custom menus in TI-BASIC simply because we didn't like the look of the built in ones or wanted it to look/act a specific way. You can always ask questions if you get stuck on something.
I think the only big issue is understanding getkey and getting rid of the habit of using Lbl/Goto to navigate between menus, then it's fine.