Currently I am trying to have Client.North and South, if an Option datum is created, scroll through the parameters of the list eg: client
and then Select figures the rest out:
if(direction == "up")
if(selected == Options.options)
selected = Options.options[Options.options.len]
option_number = Options.options.len
return //can't scroll up anymore, so go to bottom
selected = Options.options[--option_number]
Hmm, now there's a few issues, like what if I want to have client.East() move the selected object to the eastern most selection? I can't really scroll through the list of the contents properly then...
So how can I effectively go about creating a flexible menu on HUD that I can scroll through the contents with arrow keys?
THE FOLLOWING IS MY ATTEMPT, and isn't necessary to read through - but hopefully it will give you an idea of what I'm trying to do:
option_number = 1
f_choice = null
options = new
chooser = selector
selector.Options = src
for(var/a in l)
//list("startgame:7,5" , "endgame:7,4")
indexc = 1
namecount = 0
if(copytext("[a]",indexc++,indexc) == ":")
tname = copytext("[a]",1,namecount)
sloc = copytext("[a]",namecount+1)
var/obj/option/b = new
b.title = tname
b.screen_loc = sloc
selector.client.screen += b
options += b
selector.selected = options //give a default select. top of the list.
var/obj/option/final_choice = chooser.selected
chooser.selected = null
chooser.Options = null
chooser.client.screen -= chooser.highlight
chooser.f_choice = final_choice
How I want to work with the options through the variable:
var/obj/option/schoice = f_choice
f_choice = null
var/option = Option(list("START:1,5","END:1,4","CANCEL:1,3"))
if(option == "START")
world << "you selected start"
if(option == "END")
world << "you selected end"
if(option == "CANCEL")
world << "cancelled."
Any help appreciated, thanks.