I know some of the names in there are weird, but originally it was going to track parrying, but seeing how you don't actually see someone parrying, it quickly became obsolete and is now my damage tracker. Now I have a separate script for each limb, and then in each script I am using the same function but four times, one for a green counter and one for yellow, orange and red. Green of course is a healthy limb, yellow is level 1 damage orange level 2 and red being critical damage. I worked everything in for the left arm just to get things going and it works, but it quits working after a while and sometimes it will make the torso yellow for a second and glitch out. What I am figuring is that I am actually layering gauges on top of each other since I am not deleting the previous gauge before the new one is called and mudlet doesn't like this. I've searched around but can't figure out how to make a single gauge that will just change colour based on the value of a variable. If anyone has any ideas how to do this, please let me know!
Color Changing Gauges
Color Changing Gauges
Started playing around with GUI's in Mudlet, good stuff. Got some gauges together, health, willpower etc (this is in Aetolia), and they all work fine and dandy. Next I got the bright idea of a visual limb damage tracker, so I created a series of gauges to look like a head, torso, arms and legs and grouped them together to make this nice little stick figure type deal, all went fine. Next I went ahead and coded the damage tracker which is working marvelously, but here is the hitch in this giddy-up: I can't get the gauges to change color. Here is what I am using for the gauges:
Re: Color Changing Gauges
You can't have two gauges with the same name. Also, why are you using a gauge when a label would fit this job much better and simply?
Re: Color Changing Gauges
Because gauges are what I know?
Re: Color Changing Gauges
You do probably want labels, instead.
If you only have one ore two labels you could probably simplify this a lot and just list them each seperately. The functions you'd want to call are createLabel() to create the label, resizeWindow() to set the size of the label, moveWindow() to set the position of the label, setFgColor() and setBackgroundColor() to set the colors, and echo(labelname,"some text") if you want to print text in the label. Labels also let you set a picture with setBackgroundImage()
However, I like a bit more modular setup so that I can move things around when I add a new label and when I resize the winow. This is how my gui is setup. I have labels with images (compass and cond), and labels with just a color background that can change (zlighting):
setGui(gui.compass,gui.compass.northEast,"on") --sets the image to "on.png"
setTextGui(gui.zlighting,gui.zlighting,"Lght: 100","0 255 255","100 100 100") --makes the lighting label read "Lght: 100" with yellow text and a grey background.
The final result is a compass and some on/off toggle icons and a label that changes color with the lighting level, all of which is anchored to the right of the window when the window resizes.
If you only have one ore two labels you could probably simplify this a lot and just list them each seperately. The functions you'd want to call are createLabel() to create the label, resizeWindow() to set the size of the label, moveWindow() to set the position of the label, setFgColor() and setBackgroundColor() to set the colors, and echo(labelname,"some text") if you want to print text in the label. Labels also let you set a picture with setBackgroundImage()
However, I like a bit more modular setup so that I can move things around when I add a new label and when I resize the winow. This is how my gui is setup. I have labels with images (compass and cond), and labels with just a color background that can change (zlighting):
Then I have the actual function that's called when the window is resized to move the gui around, it re-renders each gui item:
And finally an example of code to update the icon label compass and lighting (text with color) labels:
setGui(gui.compass,gui.compass.northEast,"on") --sets the image to "on.png"
setTextGui(gui.zlighting,gui.zlighting,"Lght: 100","0 255 255","100 100 100") --makes the lighting label read "Lght: 100" with yellow text and a grey background.
The final result is a compass and some on/off toggle icons and a label that changes color with the lighting level, all of which is anchored to the right of the window when the window resizes.