ID:156610
 
Um, in the interface, is there a way to edit a buttons command so it's something like DialogOption(thisbuttonscurrenttext)?

Meaning, if it's text is "Hail", it'll call DialogOption("Hail"), but if it's currently "Shop", it'll call DialogOption("Shop")?

EDIT:
I meant Text, not Name.
Just incase someone was replying, I meant it's current visible text, not name.
Just put a space after the command and then the parameter you want to pass to it

For example, to send the text "Shop" to the DialogOption verb, set the Button's command to:

DialogOption "Shop"

Then in your code:

    verb/DialogOption(T as text|null)
switch(T)
if("Shop")
//Do shop stuff
if("Hail")
//ect
In response to DarkCampainger
DarkCampainger wrote:
Just put a space after the command and then the parameter you want to pass to it

For example, to send the text "Shop" to the DialogOption verb, set the Button's command to:

DialogOption "Shop"

Then in your code:

>   verb/DialogOption(T as text|null)
> switch(T)
> if("Shop")
> //Do shop stuff
> if("Hail")
> //ect
>


Not what I meant at all.

The button text changes at realtime, if it changes from Shop to "Work", I want it to send Work instead of Shop.

Edit:
Wait, I can just change the command it sends when I change the text, can't I?
In response to Asellia
You can use a winget() call to see what the text of the button is.

A is the object containing the button (usually src).

var/btn_text = winget(A, "this_window.this_control", "text")


btn_text would then contain whatever text the button currently shows. So, perhaps...

proc
DialogOption()

// grab the current text shown on the button.
var/btn_text = winget(src, "this_window.this_control","text")

if (btn_text == "Shop")
return
else if (btn_text == "Work")
return


Note that I didn't use a parameter for this. Is this something that might be doable?
In response to Asellia
@edit : uhh...yea :D

winset(src, "window.button", "command='DialogOption Work'")


you probably know that already but just making sure.