-------------------------------------------------
-- Put your Lua functions here. --
-- --
-- Note that you can also use external Scripts --
-------------------------------------------------
prompter = {}
function prompter:decisionBox(title, message,onYes,onNo)
local w, h
w,h = getMainWindowSize()
prompter.dec = {}
prompter.w=300
prompter.h=100
prompter.cw=25
prompter.ch=40
prompter.dec["yes"] = Geyser.Label:new({
name="yesBox",
message="<center>Yes</center>",
x=w/2-prompter.w/2,
y=h/2+prompter.h/2,
width=prompter.w/2,
height=prompter.ch,
callback=onYes
})
prompter.dec["no"] = Geyser.Label:new({
name="noBox",
message="<center>No</center>",
x=w/2,
y=h/2+prompter.h/2,
width=prompter.w/2,
height=prompter.ch,
callback=onNo
})
setLabelStyleSheet("yesBox", [[
background-color: green;
color: black;
]])
setLabelStyleSheet("noBox", [[
background-color: red;
color: black;
]])
prompter.dec["frame"] = Geyser.Label:new({
name="promptDecision",
message="<center>"..message.."</center>",
x=w/2-prompter.w/2,
y=h/2-prompter.h/2,
width=prompter.w,
height=prompter.h,
})
setLabelStyleSheet("promptDecision", [[
background-color: grey;
]])
end
function prompter:Dest()
prompter.dec["frame"]:hide()
prompter.dec["yes"]:hide()
prompter.dec["no"]:hide()
end
function onDecYes(args)
display('yes')
prompter:Dest()
end
function onDecNo(args)
display('no')
prompter:Dest()
end
prompter:decisionBox("title frame", "do you want to do this","onDecYes","onDecNo")
Geyser UI Scripts
Geyser UI Scripts
I think it would be nice to have some more abstractable user interface options with Geyser. The first one that came to my mind was a prompt for a user to click on:
I'd love to see what others have made
Re: Geyser UI Scripts
Quite Brilliant!!!
And beautifully demonstrated.
And beautifully demonstrated.
Re: Geyser UI Scripts
Oh, that is a neat idea.
Re: Geyser UI Scripts
Brilliant. Now if only you could make a Dialog Input box that would ask for a spicific Value, such as, "What city would you like to add this Person to?" with an input field. Stupid example, but the usages would be endless. Bit then again, you could probably just use the Mudlet Prompt.
Re: Geyser UI Scripts
There is no text focus for labels, but it'd be trivial to accept things like the next input in the command line following a click
Re: Geyser UI Scripts
Here's that idea materialized:
Note that it takes in the function, not the function name as a callback. There's loads of improvements you can do on this, it is just a basic example.
Re: Geyser UI Scripts
To get a line-break, use the <br> character as well. \n doesn't work, HTML formatting seems to be needed. For my instance, I use this script to handle room collisions. If a player has a room colliding it'll prompt to have the map manage the collision automatically or cancel room creation.
Re: Geyser UI Scripts
Here's my own attempt at it. The idea was to have it create a custom label. After the label is created, it will loop back to the original prompter.
Last edited by Akaya on Sat Dec 15, 2012 8:20 am, edited 3 times in total.
Re: Geyser UI Scripts
Haha, that's really interesting. The font size on the label though was too big until after the X position question, after that it scaled down and all the text fit.
Re: Geyser UI Scripts
The images don't show though, you hardcoded them to your computer - changing to the following, as an example:
Would fix it.