My last post on this. I complained about no comments in someone elses script when I didn't say anything within my own. I've started working on more graphical guis but didn't feel like this was complete until I commented on what I've done so you can see what's happening.
Server_ID and initialise_msdp I can't say much about, because all it does is tell the mud to report to you which msdp variables you want sent to you're client. Then it's up to you as to how to display it. Note that the variables in initialise_msdp aren't the complete set of variables this mud has, so add the new ones as you need them the same way the rest are written.
I know this is a bad way to do a layout. You should REALLY not update a whole gui every time an event is triggered. More advanced I would assign functions
to various sections to update variables without redoing everything, but this is a learning environment and everyone has to start everywhere. I've commened everything below. I may not know exactly what Im doing half the time, or might comment wrong. Lemme know if this is the case. But! At least you will see what's going through my head while doing this.
-- where I start my layout. It gets called everytime the MSDP variables change. If you were to see the Handler Variables from the gui editor you would see all the MSDP variables tacked on to this script. What I could do better is to add more functions to change how variables are updated to the layout, put handler MSDP just for those functions, and stop redrawing the layout every time something happens.
function layout()
-- Setting my boarders for the left side of the main window.
setBorderLeft(210)
-- this is where I name the containers of the screen where I will put labels with my info. The labels are the boxes you see with the stats in it. The container once again is the location of the screen where the labels will be placed. I then named one of the container as left_container so I can call it specifically when adding labels to place content on the screen. The variables are location of x/y positioning of where the container starts at, the width of how wide I want my container to be, and I made the Hight 100% so it covers the whole hight area of the left side where I specified how wide it would be.
left_container = Geyser.Container:new({
name = "left_container", -- give it a unique name here
x=0, y=0, -- have it start at the top-left corner of mudlet
width = 200, height="100%", -- with a width of 200, and a height of the full screen, hence 100%
})
setBorderRight(210)
right_container = Geyser.Container:new({
name = "right_container", -- give it a unique name here
x=0, y=0, -- have it start at the top-left corner of mudlet
width = 200, height="100%", -- with a width of 200, and a height of the full screen, hence 100%
})
setBorderTop(100)
top_container = Geyser.Container:new({
name = "top_container", -- give it a unique name here
x=0, y=0, -- have it start at the top-left corner of mudlet
width ="100%", height= 100, -- with a width of 200, and a height of the full screen, hence 100%
})
setBorderBottom(100)
bottom_container = Geyser.Container:new({
name = "bottom_container", -- give it a unique name here
x=0, y=0, -- have it start at the top-left corner of mudlet
width = "100%", height= 100, -- with a width of 200, and a height of the full screen, hence 100%
})
-- Here I made a new label for the boarder for sloth. You can see it references top_container as the area it's to be placed within. width/height end up showing the percentage of how much I'm filling the container, instead of the whole screen, since top_container is the parent area of where the label is placed. X/y is placement from within the container area. Values can place this outside of the container, but It can be helpful for other reasons, such as moving a whole container somewhere else on the screen. The stylesheet gives me the fancy oval like boarders/width/font ect. It makes it look better overall. The same can be said with the other labels. Not hard to do once you get it down. It just takes some playing with to get the values right for positioning and how you want the look and feel to be.
Top_Border = Geyser.Label:new({
name = "Top_Border",
x = "15%", y = "0%",
width = "70%", height = "95%",
message = [[<center><font size=40>SLOTHMUD - A RETURN TO ITS ORIGINS</font></center>]]
}, top_container)
Top_Border:setStyleSheet([[
background-color: black;
border-width: 2px;
border-style: solid;
border-color: grey;
border-radius: 10px;
font: bold "Monospace";
font-size: 14px;
]])
Locations = Geyser.Label:new({
name = "Locations",
x = "0%", y = "0%",
width = "100%", height = "25%"
}, left_container)
Locations:setStyleSheet([[
background-color: black;
border-width: 2px;
border-style: solid;
border-color: grey;
border-radius: 10px;
font: bold "Monospace";
font-size: 1px;
]])
-- MSDP values, unless stored by lua again as something user defined will always be "atcp.MSDP(somevariablehere)" Partly because we are using atcp to fetch our MSDP variables. Below I'm just using echo to directly display our information to the labels. This one is sending echo text to the Locations label we made earlier on. <br> will return you to the next line, while <hr> makes the devider line between each stat I had displayed. Play with it a bit and you'll know just how to change it to suit your own needs. You can go to the statistics button in the area to see every msdp value I have getting reported for this plugin, as well as the values. Debug can also be benefitial to see where scripts are firing, and areas where you think they are, yet nothing is actually happening.
Locations:echo("LOCATION INFORMATION:<br><hr><br>Continent:"..atcp.MSDPCONTINENT.."<hr>Area: "..atcp.MSDPAREA_NAME.."<hr>Room: "..atcp.MSDPROOM_NAME.."<hr>Exits: "..atcp.MSDPROOM_EXITS.."<hr>Terrain: "..atcp.MSDPTERRAIN.."<hr>Room ID: "..atcp.MSDPROOM_VNUM)
Grouping = Geyser.Label:new({
name = "Grouping",
x = "0%", y = "25%",
width = "100%", height = "35%"
}, left_container)
Grouping:setStyleSheet([[
background-color: black;
border-width: 2px;
border-style: solid;
border-color: grey;
border-radius: 10px;
font: bold "Monospace";
font-size: 4px;
]])
Grouping:echo("GROUP FIGHTING:<br><hr><br>Group Leader: "..atcp.MSDPGROUP_LEADER.."<hr>Tank Name: "..atcp.MSDPTANK_NAME.."<hr>Tank Health: "..atcp.MSDPTANK_HEALTH.."/"..atcp.MSDPTANK_HEALTH_MAX.."<hr>Tank Level: "..atcp.MSDPTANK_LEVEL.."<hr><br>Enemy: "..atcp.MSDPOPPONENT_NAME.."<hr>Level: "..atcp.MSDPOPPONENT_LEVEL.."<hr>Health: "..atcp.MSDPOPPONENT_HEALTH.."/"..atcp.MSDPOPPONENT_HEALTH_MAX)
--echo("Grouping", "[[<p style="font-family: monospace; font-size:small;">]][[GROUP FIGHTING: <br>==============<br>Group Leader: ]]..atcp.MSDPGROUP_LEADER..[[<br>Tank Name: ]]..atcp.MSDPTANK_NAME..[[<br>Tank Health: ]]..atcp.MSDPTANK_HEALTH..[[/]]..atcp.MSDPTANK_HEALTH_MAX..[[<br>Tank Level: ]]..atcp.MSDPTANK_LEVEL..[[<br><br>Enemy: ]]..atcp.MSDPOPPONENT_NAME..[[<br>Level: ]]..atcp.MSDPOPPONENT_LEVEL..[[<br>Health: ]]..atcp.MSDPOPPONENT_HEALTH..[[/]]..atcp.MSDPOPPONENT_HEALTH_MAX[[</p>]])
Statistics = Geyser.Label:new({
name = "Statistics",
x = "580%", y = "0%",
width = "100%", height = "100%"
}, right_container)
Statistics:setStyleSheet([[
background-color: black;
border-width: 2px;
border-style: solid;
border-color: grey;
border-radius: 10px;
font: bold "Monospace";
font-size: 6px;
]])
Statistics:echo("STATS INFORMATION:<hr>Name: "..atcp.MSDPCHARACTER_NAME.."<br>Citizen of "..atcp.MSDPCITIZEN.."<br> Your alignment is: "..atcp.MSDPALIGNMENT.."<br>Sex: "..atcp.MSDPSEX.."<hr>Money: "..atcp.MSDPMONEY.."<br>Drachma: "..atcp.MSDPDRACHMA.."<hr>Levels:<br>"..atcp.MSDPCLASS.." "..atcp.MSDPLEVEL.." "..atcp.MSDPCLASS_SEC.." "..atcp.MSDPLEVEL_SEC.." "..atcp.MSDPCLASS_TER.." "..atcp.MSDPLEVEL_TER.." "..atcp.MSDPCLASS_QUA.." "..atcp.MSDPLEVEL_QUA.."<br>"..atcp.MSDPCLASS_QUI.." "..atcp.MSDPLEVEL_QUI.." "..atcp.MSDPCLASS_HEX.." "..atcp.MSDPLEVEL_HEX.." "..atcp.MSDPCLASS_SEP.." "..atcp.MSDPLEVEL_SEP.." "..atcp.MSDPCLASS_OCT.." "..atcp.MSDPLEVEL_OCT.."<br>Avatar: "..atcp.MSDPCLASS_AVA.." "..atcp.MSDPLEVEL_AVA.."<hr> Experience: "..atcp.MSDPEXPERIENCE.."<hr>Health: "..atcp.MSDPHEALTH.." / "..atcp.MSDPHEALTH_MAX.."<hr> Mana: "..atcp.MSDPMANA.." / "..atcp.MSDPMANA_MAX.."<hr> Moves: "..atcp.MSDPMOVEMENT.." / "..atcp.MSDPMOVEMENT_MAX.."<hr> AC: "..atcp.MSDPAC.."<hr> HONOR: "..atcp.MSDPHONOR.."<hr> STR:"..atcp.MSDPSTR.."/"..atcp.MSDPSTR_PERM.." CON:"..atcp.MSDPCON.."/"..atcp.MSDPCON_PERM.."<br> DEX:"..atcp.MSDPDEX.."/"..atcp.MSDPDEX_PERM.." WIS:"..atcp.MSDPWIS.."/"..atcp.MSDPWIS_PERM.."<br>INT:"..atcp.MSDPINT.."/"..atcp.MSDPINT_PERM.." CHAR:"..atcp.MSDPCHARISMA.."/"..atcp.MSDPCHARISMA_CAP.."<hr>Spells and Damage:<br>Weapon Damage: "..atcp.MSDPWEAPON_DAM.."<br>Stab Damage: "..atcp.MSDPSTAB_DAM.."/"..atcp.MSDPSTAB_DAM_CAP.."<br>Hand Damage: "..atcp.MSDPHAND_DAM.."/"..atcp.MSDPHAND_DAM_CAP.."<br> Undead Cont: "..atcp.MSDPUNDEAD_CONT.."/"..atcp.MSDPUNDEAD_CONT_CAP.."<br>Spell Bonus: "..atcp.MSDPSPELL_BONUS.."/"..atcp.MSDPSPELL_BONUS_CAP.."<br>Heal Bonus: "..atcp.MSDPHEAL_BONUS.."/"..atcp.MSDPHEAL_BONUS_CAP.."<hr>Hitroll: "..atcp.MSDPHITROLL.."<hr>Damroll: "..atcp.MSDPDAMROLL.."<hr>Damage Red: "..atcp.MSDPDAM_RED.."/"..atcp.MSDPDAM_RED_CAP)
end
-- Thanks. I didn't write the same thing for every line on here, but I think you get the general picture of what I did on here. Note that this isn't even scratching the surface of what mudlet can do. I'm just a newbie doing what I like to do best, playing with code, seeing how things work, and happy when something does work right, no matter how easy it may seem for others lol. Hope this can help anyone.
One tip when scripting, when you don't know if something is working right or not, is to place echo("test1") ... within various places in your script if you are unsure if things are being called. Echo variables to make sure they are being called or updated echo(somevariablehere) or like I've done sometimes echo("This is where I started such and such") or echo("This variable just got stored with the value"..somevaluename)
Good luck!