Jump to content
  • 0

How to use array as a Menu


Question

7 answers to this question

Recommended Posts

Posted

Here we go:

 

 

setarray .@menuStrs$[0], "Warp","Fly","Shit";
 
set @menu$,"";
for (set @i,0; @i < getarraysize(.@menuStrs$); set @i,@i+1) {
    if (@i) set @menu$,@menu$+":";
    set @menu$,@menu$+.@menuStrs$[@i];
}
set @selection,select(@menu$)-1;

 

This should work.

Posted

I was looking for a way without needing to use a for loop to create a menu, but I guess I'll stick to what I know.

 

setarray .item$[0],"Apple","Chocolate";

set .@selection, select(.@item$) -1;
 

 

That what I wanted to achieve without the for loop.

 

 

Heres what I added.

for(set .@i,0; .@i<getarraysize(.@item$); .@i++)
                set .@menu$, .@menu$ + .item$[.@i] + ":";
 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...