Jump to content
  • 0

How to use array as a Menu


-SkittleNugget-

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

*remove*

 

 

 

I'll just use a for loop and create it into a menu. >.<

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  



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

set .@menu$,implode(.item$, ":");

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

Edited by QQfoolsorellina
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

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] + ":";
 

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

I was trying to use the explode statement.

 

Thank you QQfoolsorellina >3

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

implode didn't exist in my time of scripting :C

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

I know a simple one.

set .@simple$, "L:I:L";
switch ( select( .@simple$ ) ) { 
case 1: break;
case 2: break;
case 3: break;
}
Link to comment
Share on other sites

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.

×
×
  • Create New...