Basically I'm trying to use string IDs (or the old school script IDs) to set a "menu item subtype (menutype:@script)" to a specific script from a selection based on an outcome.
This is a rough mock up of what I've tried so far.
plotscript, menubits, begin
(variables) (my menu, menu slot, condition)
#stuff
# based on an outcome either A or B will be stored in string $1
if (condition == 1) then(
get script name (1, @script A)
)
if (condition == 2) then(
get script name (1, @script B)
)
my menu := open menu (1)
menu slot := add menu item (menu2)
set menu item type (menu slot, menutype: script)
# append script outcome to the "menutype:@script"
set menu item subtype (menu slot, @$1)
end
To save some time, this didn't work. However, I'm wondering if this is even possible right now? Or am I just doing this the wrong way?
You can't refer to a string by writing $1. You see, '$1 = "apples"' does not mean assign "apples" to $1. Instead, $...="..." is one single indivisible construct. It's very weird.
You can't lookup a script by name, but actually what you want to do is quite easy: '@scriptA' is equal to the ID number of scriptA:
set menu item type (menu slot, menutype: script)
if (condition == 1) then(
set menu item subtype (menu slot, @script A)
)
if (condition == 2) then(
set menu item subtype (menu slot, @script B)
)
Last edited by TMC on Tue Jan 23, 2018 11:13 am, edited 3 times in total.