Jump to content
  • 0

question on arrays


SilverMayCry

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  55
  • Reputation:   2
  • Joined:  12/29/11
  • Last Seen:  

how do i put the selection on my array here
 
announce ""+strcharinfo(0)+": "+.Message$+"",bc_all,0;
 
if i make an array like this of hex codes
 
setarray .color$[0],"0xFF0000","0xFF4000","0xFF8000","0xFFBF00","0xFFFF00","0xBFFF00","0x80FF00","0x40FF00","0xFA5882","0x0101DF","0x7401DF";

set .@menu$,implode(.color$, ":");
set .@selection, select(.@menu$) -1;

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

wow it's such a complicated code..
 
If I were you, I probably will do something like this:
 

set .@choice$,"0xFF0000","0xFF4000","0xFF8000","0xFFBF00","0xFFFF00","0xBFFF00","0x80FF00","0x40FF00","0xFA5882","0x0101DF","0x7401DF";
select .@choice$;

explode(.@option$,.@choice$,":");
 
<then on the broadcast>
 
announce ""+strcharinfo(0)+": "+.Message$+"",bc_all,.@option$[@menu-1];
 

reference: rathena.org/wiki/Select

Edited by Winz
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  55
  • Reputation:   2
  • Joined:  12/29/11
  • Last Seen:  

thanks man, figured it out i did it this way instead.

setarray .@cname$[0],"Green","Red","Purple","Pink","Orange";
setarray .@color$[0],"0x33FF33","0xD20000","0xCC00FF","0xFF33CC","0xFF9900";

then i set menu

 

for (set .@c, 0; .@c < getarraysize(.@cname$); set .@c, .@c + 1){
set .@menu_cname$[getarraysize(.@menu_cname$)], .@cname$[.@c];
set .@menu_index[getarraysize(.@menu_index)], .@c;
set .@menu$, .@menu_cname$[0];
for (set .@c, 1; .@c < getarraysize(.@menu_cname$); set .@c, .@c + 1) {
set .@menu$, .@menu$ + ":" + .@menu_cname$[.@c];
}

set .@c, select(.@menu$) - 1; 
input .Message$;
next;
announce ""+strcharinfo(0)+": "+.Message$+"",bc_all,.@color$[.@c];

 

Edited by SilverMayCry
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

k k


mark as answered / solved.

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...