Not a lot of people used it in the last forums, but I am bringing this back. So I am trying to create some buttons to toggle fucntions, so I am using geyser labels. I can make the button and all that just fine, but I am having trouble with the setClickCallback function. Here is what I am using
[spoiler]
testlabel = Geyser.Label:new({
name = "testlabel",
x = "1", y = 691,
width = "85", height = "25",
fgColor = "DodgerBlue",
color = "navy",
message = [[<center>Precache</center>]]
})
setClickCallback("precache_off")
function precache_off()
if osmosis.precache then
send("i_off precache")
else
send("i_on precache")
end
[/spoiler]
This isn't working, anyone have any ideas?
1
Comments
[code]testlabel:setClickCallbac("precache_off")[/code]
http://pastebin.com/9J4AQjJL
I am having issues with my buttons randomly moving south a bit. It looks like they are moving down my screen almost exactly the height of the buttons themselves. Not sure exactly why this is, here is what I am using for each button:
[spoiler]
function call_herb()
herbcontrol = Geyser.Label:new({
name = "herbcontrol",
x = 1117, y = 750,
width = "60px", height = "30px",
fgColor = "black",
color = osmosis.citadel.controls.herb,
message = [[<center>Herbs</center>]]
})
herbcontrol:setClickCallback("herb_toggle")
end
call_herb()
[/spoiler]
I then have a function of course that actually checks for the circumstances in toggling said button. I can't figure out why they keep moving on me though.
function keepalive()
sendGMCP("Core.KeepAlive")
if keepalive then
killTimer(keepalive)
end
keepalive = tempTimer(60, [[keepalive()]])
end
keepalive()
And your gagging function:
function gaglp()
deleteLine()
tempLineTrigger(1, 1, [[
if isPrompt() then deleteLine() end
]])
end
GMCP events are fairly straightforward - events in general are a bit trickier and I haven't messed around with any player-created ones, so I'll leave that for someone else.
Basically, you make a script (click the Scripts button on your menu bar, then click Add Item). It needs to contain a function and an event handler, and the script file needs to be named the same as the function. So if your function is called onVitalUpdate, your script needs to be called onVitalUpdate. I don't know why this is, it's just a thing I discovered back when I was learning Mudlet. This function will be called whenever your event handler is called.
In the box labelled 'Add User Defined Event Handler', you need to write the exact table name of the GMCP data that you would like to cause the event to fire. So, if you're writing a function that you want to fire every time you get new character vital data, like HP, balances, all that, you would write 'gmcp.Char.Vitals' into the 'Add User Defined Event Handler' box, and click the plus button. It should pop up in the Registered Event Handler box. Here's a screenshot to show you how it should end up looking:
[spoiler][/spoiler]
You can also get rid of double prompts and minimize spam by putting the following into your prompt trigger. Basically it will only show your prompt if it's not identical to the previous prompt.
[spoiler]
example
return isPrompt() with the pattern type as a lua function
This will catch any and all prompt variations, though you'd still have to use regex(be it another pattern or code) to pull data from the line if you can't get it elsewhere, like from gmcp.