ID:158956
 
I have seen it on a few games to date, and I need to know how to do it..
I would initiate a input like so;
src.blah<<input("Your name goes here","Name") as text


But I have yet to figure out how to close the input if the person does not respond to it in a matter of time (such at a minute)

Mind helping me out?
Make a new datum.

input
New(mob/M,T)
..()
spawn(600)del(src) // del after 1 min
M<<input("[T]")as text

mob/verb/InputMe(T as text)
new/input(usr,T)
In response to Takoma
Ok thanks.

EDIT: It didn't work. Time to rethink this.. A friend said that it could be achieved via Interface but I have little to no idea what he meant by it.
//these will handle the stuff
proc
get_input(wait = 100 as num,mob/U,Message,Title,Default,Type,list/List)
var/prompts/input/Input = new
var/Option
spawn(wait) if(!Option) del Input
Option = Input.option(U,Message,Title,Default,Type,List)
return Option
get_alert(wait = 100 as num,mob/U,Message,Title,Button1,Button2,Button3)
var/prompts/alert/Alert = new
var/Option
spawn(wait) if(!Option) del Alert
Option = Alert.option(U,Message,Title,Button1,Button2,Button3)
return Option
prompts
input
proc/option(mob/U,Message="",Title="",Default="",Type,list/List)
switch(Type)
if("text") return input(U,Message,Title,Default) as text
if("text|null") return input(U,Message,Title,Default) as text|null
if("password") return input(U,Message,Title,Default) as password
if("password|null") return input(U,Message,Title,Default) as password|null
if("command_text") return input(U,Message,Title,Default) as command_text
if("command_text|null") return input(U,Message,Title,Default) as command_text|null
if("icon") return input(U,Message,Title,Default) as icon
if("icon|null") return input(U,Message,Title,Default) as icon|null
if("sound") return input(U,Message,Title,Default) as sound
if("sound|null") return input(U,Message,Title,Default) as sound|null
if("num") return input(U,Message,Title,Default) as num
if("num|null") return input(U,Message,Title,Default) as num|null
if("message") return input(U,Message,Title,Default) as message
if("message|null") return input(U,Message,Title,Default) as message|null
if("mob") return input(U,Message,Title,Default) as mob in List
if("obj") return input(U,Message,Title,Default) as obj in List
if("turf") return input(U,Message,Title,Default) as turf in List
if("area") return input(U,Message,Title,Default) as area in List
else return input(U,Message,Title,Default) in List
alert
proc/option(mob/U,Message,Title,Button1="Ok",Button2,Button3)
return alert(U,Message,Title,Button1,Button2,Button3)
//to use them
mob/verb
AlertWindow()
var/alert = get_alert(20,usr,"2 sec for user to respond","title","Yes","No")
if(alert=="Yes")
world<<"yay it's yes"
InputWindow()
var/input = get_input(20,usr,"2 sec for user to type name","title","default text","text")
world<<input
In response to Ripiz
Ripiz wrote:
> //these will handle the stuff
> proc
> get_input(wait = 100 as num,mob/U,Message,Title,Default,Type,list/List)
> var/prompts/input/Input = new
> var/Option
> spawn(wait) if(!Option) del Input
> Option = Input.option(U,Message,Title,Default,Type,List)
> return Option
> get_alert(wait = 100 as num,mob/U,Message,Title,Button1,Button2,Button3)
> var/prompts/alert/Alert = new
> var/Option
> spawn(wait) if(!Option) del Alert
> Option = Alert.option(U,Message,Title,Button1,Button2,Button3)
> return Option
> prompts
> input
> proc/option(mob/U,Message="",Title="",Default="",Type,list/List)
> switch(Type)
> if("text") return input(U,Message,Title,Default) as text
> if("text|null") return input(U,Message,Title,Default) as text|null
> if("password") return input(U,Message,Title,Default) as password
> if("password|null") return input(U,Message,Title,Default) as password|null
> if("command_text") return input(U,Message,Title,Default) as command_text
> if("command_text|null") return input(U,Message,Title,Default) as command_text|null
> if("icon") return input(U,Message,Title,Default) as icon
> if("icon|null") return input(U,Message,Title,Default) as icon|null
> if("sound") return input(U,Message,Title,Default) as sound
> if("sound|null") return input(U,Message,Title,Default) as sound|null
> if("num") return input(U,Message,Title,Default) as num
> if("num|null") return input(U,Message,Title,Default) as num|null
> if("message") return input(U,Message,Title,Default) as message
> if("message|null") return input(U,Message,Title,Default) as message|null
> if("mob") return input(U,Message,Title,Default) as mob in List
> if("obj") return input(U,Message,Title,Default) as obj in List
> if("turf") return input(U,Message,Title,Default) as turf in List
> if("area") return input(U,Message,Title,Default) as area in List
> else return input(U,Message,Title,Default) in List
> alert
> proc/option(mob/U,Message,Title,Button1="Ok",Button2,Button3)
> return alert(U,Message,Title,Button1,Button2,Button3)
> //to use them
> mob/verb
> AlertWindow()
> var/alert = get_alert(20,usr,"2 sec for user to respond","title","Yes","No")
> if(alert=="Yes")
> world<<"yay it's yes"
> InputWindow()
> var/input = get_input(20,usr,"2 sec for user to type name","title","default text","text")
> world<<input
>


Wow that is very helpful, but if some of the older helpers saw that you might get told off for not commenting, just to let you know.

So I am going to try this out, and I will post back here to let you all know. Thanks.
EDIT: Yeah it works beautifully, thank you!
In response to VolksBlade
You could make a skin alert using windows, or you could just use the datum approach.

Deleting the datum with the input closes the input, probably returning null. Just one of those unknown features.