ID:1353683
 
(See the best response by Neimo.)
Sorry if this is the wrong section, but i figured it would give me the best results here.

I play a game where you can select one of your mobs and push the I key to bring up an interact menu, which brings up a var/list

when you select an option in this list, it brings up another list.

I want to take one of the commands from the second embedded list and turn it into a macro.

I have the source code, and can provide a snippet if it could help.

thanks for reading.
You can create a variable that stores the atom you click and with the created macro, check if the atom isn't null and show the interaction menu. Then display your options and have them however you'd like. Provide the snippet, it would be beneficial.
mob/verb/Interact() for(var/mob/Monsters/M in usr.Selected)
var/list/menu = new()
menu += "Closest Creature"
menu += "This Creature"


.....Further down the code....
    if (Result == "This Creature")
var/list/menu2 = new()
if(M.SubRace == "Queen") menu2 += "Lay Egg"
if(M.Race == "Dragon")
menu2 += "Dragon Breath"

further down again.. this is the what i want to turn into a macro on my client, not in the code.
            if("Dragon Breath") M.DragonBreath(M.MagicTarget)



I could provide the code in its entireness, but its at about 600+ lines when it reaches this point.

In response to Brad35309
Best response
That wouldn't be necessary.

var/list/main_menu = list("Option 1", "Option 2")
var/list/sub_menu = new
var/option_selected = input() in main_menu

// after selecting your option, add options to the sub-menu
switch(option_selected)
if("Option 1")
// do something based on race
switch(race_condition)
if("some race")
sub_menu += "Fireball"
if("some other race")
sub_menu += "Glacial Freeze"
if("Option 2")
// do something based on levels
switch(level_condition)
if(100)
sub_menu += "Superball"
if(150)
sub_menu += "Obliterate"
// one your sub menu has been generated, do something
if(!sub_menu.len)
return

option_selected = input() in sub_menu
switch(option_selected)
if("Fireball")
do an action
...
Not quite what im getting at. What im trying to do is turn an option from this list into a macro on my client.
In response to Brad35309
So use winset? You have to be a bit more thorough with what you're asking for.

winset(src, "control id", "parent = macro; name = KEY; command = [option_selected]")
In response to Neimo
It's extremely clear by now that what he wants to do is select an option from the input() popup using a macro.

There's no simple way to do this.
In response to Kaiochao
Oh, lol. I'm just a tad bit slow.
I apologize for the necro, but I can't find any thread more relevant than this one.

Kaiochao said there's no simple way to do this, but is there a way at all? I don't mind how convoluted it gets as long as I can do it.