Geyser/MiniConsole Help

by Zilias

Back to Mechanic's Corner.

Zilias2012-02-20 19:03:33
Ok, so I have been working with the examples on the Mudlet website on how to use Geyser Labels/Containers, as well as creating MiniConsoles. I am having trouble figuring out how to move an already created Wounding Monitor into a Geyser Window. Is there anybody who can provide some sample script that shows how to use and manipulate a Geyser windows contents where multiple lines are being drawn?

Currently this is what my wounding monitor looks like in a basic miniconsole:

*******TARGET WOUNDS********
* TARGET : undefined
* Health : undefined
* --------------------------
* Head Wounds : undefined
* Chest Wounds : undefined
* Gut Wounds : undefined
* LArm Wounds : undefined
* RArm Wounds : undefined
* LLeg Wounds : undefined
* RLeg Wounds : undefined
* --------------------------
* Bleeding : undefined
****************************


If anybody can shed some light on how to convert this to a Geyser that would be great. All of the "undefined" are variables, everything else is just plain white text. The reason I want to move this into Geyser is because in a miniconsole the lines do not load if the variables are not set to a value and I want to be able to change the colors based on wounding level and things like that. I also may eventually add tabs for additionsl monitors.

Any help is appreciated!
Neos2012-02-20 19:32:18
Short answer: Geyser uses miniconsoles, just in a different way that helps organizing them.
If I was on my laptop could whip up some pseudo-code for you, I use a similar display for my demesne display.
Zilias2012-02-20 20:16:04
That would be cool, if you get the chance.
Unknown2012-02-20 20:43:44
Well, if the issue is just that the values are not set, do something like:

wounds.head = wounds.head or 0

Post some sample code if that does not make sense. Pushing this over to Geyser will make no difference as it uses miniconsoles, too. The issue is down to the way your are declaring from what I understand after reading your post.
Zilias2012-02-20 22:08:47
Alright here is what I am currently doing:

This is the miniconsole code as well as the initial veriable declarations:


createMiniConsole("wounds", 900, 2, 225, 250)
setBackgroundColor("wounds", 0, 0, 0, 110)
setMiniConsoleFontSize("wounds", 9)
setWindowWrap("wounds", 30)
function woundsdisplay()
clearUserWindow("wounds")
echo("wounds", "\\n*******TARGET WOUNDS********" )
echo("wounds", "\\n* TARGET : ".. target)
echo("wounds", "\\n* Health : ".. targethealth)
echo("wounds", "\\n* --------------------------")
echo("wounds", "\\n* Head Wounds : ".. headwounds)
echo("wounds", "\\n* Chest Wounds : ".. chestwounds)
echo("wounds", "\\n* Gut Wounds : ".. gutwounds)
echo("wounds", "\\n* LArm Wounds : ".. leftarmwounds)
echo("wounds", "\\n* RArm Wounds : ".. rightarmwounds)
echo("wounds", "\\n* LLeg Wounds : ".. leftlegwounds)
echo("wounds", "\\n* RLeg Wounds : ".. rightlegwounds)
echo("wounds", "\\n* --------------------------")
echo("wounds", "\\n* Bleeding : ".. bleeding)
echo("wounds", "\\n****************************")
end
function resetWounds()
target = "undefined"
targethealth = "undefined"
headwounds = "undefined"
chestwounds = "undefined"
gutwounds = "undefined"
leftarmwounds = "undefined"
rightarmwounds = "undefined"
leftlegwounds = "undefined"
rightlegwounds = "undefined"
bleeding = "undefined"
end


That is loaded off a trigger that recognizes my password was entered correctly. Then when I set a target, it assess's them and pulls the wounds, bleeding, player name and life values from ASSESS while gagging all off the assess lines. Using a set of trigger lines compared to the assess table that is drawn when you ASSESS.

Each time I gain balance after swinging, it auto assess's for the newest values and rewrites the values to the console. This may not be the best way to do what I am doing but it was the only way I could figure out with my limited Lua and Mudlet knowledge. Feel free to bash on it :)
Neos2012-02-20 22:35:48

function resetWounds()
target = target or "undefined"
targethealth = targethealth or "undefined"
headwounds = headwounds or "undefined"
chestwounds = chestwounds or "undefined"
gutwounds = gutwounds or "undefined"
leftarmwounds = leftarmwounds or "undefined"
rightarmwounds = rightarmwounds or "undefined"
leftlegwounds = leftlegwounds or "undefined"
rightlegwounds = rightlegwounds or "undefined"
bleeding = bleeding or "undefined"
end
createMiniConsole("wounds", 900, 2, 225, 250)
setBackgroundColor("wounds", 0, 0, 0, 110)
setMiniConsoleFontSize("wounds";, 9)
setWindowWrap("wounds", 30)
function woundsdisplay()
clearUserWindow("wounds")
echo("wounds", "\\n*******TARGET WOUNDS********")
echo("wounds", "\\n* TARGET   : ".. target)
echo("wounds", "\\n* Health   : ".. targethealth)
echo("wounds", "\\n* --------------------------")
echo("wounds", "\\n* Head Wounds  : ".. headwounds)
echo("wounds", "\\n* Chest Wounds : ".. chestwounds)
echo("wounds";, "\\n* Gut Wounds   : ".. gutwounds)
echo("wounds", "\\n* LArm Wounds  : ".. leftarmwounds)
echo("wounds", "\\n* RArm Wounds  : ".. rightarmwounds)
echo("wounds";, "\\n* LLeg Wounds  : ".. leftlegwounds)
echo("wounds", "\\n* RLeg Wounds  : ".. rightlegwounds)
echo("wounds", "\\n* --------------------------")
echo("wounds", "\\n* Bleeding : ".. bleeding)
echo("wounds", "\\n****************************")
end
Unknown2012-02-20 22:52:01
Okay. I moved all the declarations to the sysLoadEvent handler, rather than a trigger.

I have also changed your variables to mostly integers, as I suspect that you were trying to evaluate a string with an integer. (This is likely what was causing you the issues.)

I've also tidied things up somewhat and made it all easier to read overall.

Just unpack the archive and import the scripts via the editor.

Enjoy! :)

Neos2012-02-20 22:55:52
Way to show me up. :(
Not serious. He has a comp to use, I'm editing on my iPod.
Unknown2012-02-20 22:58:24
AquaNeos:

Way to show me up. :(
Not serious. He has a comp to use, I'm editing on my iPod.



Hehe. Sorry! <3
Unknown2012-02-21 01:58:42
I thought I'd just recommend using string.format() instead of all those individual echos. Not necessary, just another method!
Vadi2012-02-21 02:51:19

echo("wounds", string.format(],
target or '?', targethealth or '?',
headwounds or '?', chestwounds or '?', gutwounds or '?', leftarmwounds or '?', rightarmwounds or '?', leftlegwound or '?', rightlegwounds or '?',
bleeding or '?'))
Unknown2012-02-21 03:35:18
Vadi is the best. :wub:
Zilias2012-02-21 06:07:36
So, all of this has really helped clean up my code. I seriously appreciate it.

One question though, is this what is considered a Geyser MiniConsole? I don't need to do the "lolcal Geyser.Label = new" and then the Window:echo(" stuff?
Unknown2012-02-21 10:04:30
Geyser is just a framework for creating and editing console frames (or widgets if you prefer.) - It does not do anything differently than what you might expect, rather it makes things easier and streamlines pretty well.