Page 1 of 1
MiniConsole Aff Tracker
Posted: Thu Jan 24, 2013 3:26 am
by icesteruk
I was browsing the GUI section of these forums and found a neat code to add a console of sorts to my mudlet to show me which affs I have.. I've changed the few things which needed changing to meet my needs but I seem to be having an error..
The error is, the window is showing perfect but it always shows the 'false' and 'true' afflictions..
function init()
winX, winY = getMainWindowSize()
createMiniConsole("aff_display", winX-530,420,510,180)
setBackgroundColor("aff_display", 150, 150, 150, 255)
setMiniConsoleFontSize( "aff_display", 10 )
setFgColor("aff_display", 10, 0, 0)
setBgColor("aff_display", 150, 150, 150)
end
init()
function refreshAffs()
clearWindow("aff_display")
echo("aff_display","\nAfflictions:\n\n")
for k,v in pairs(afflictionQueue) do
echo("aff_display", k.."\n")
end
end
the table which I am trying to show -
table {
'impatience': false
'blindness': false
'indifference': false
'insulation': false
'stupidity': false
'epilepsy': false
'deafness': false
}
Re: MiniConsole Aff Tracker
Posted: Thu Jan 24, 2013 4:26 am
by icesteruk
can someone please delete this post/topic..
I found the problem was missing a
if v == true then - working good now
Re: MiniConsole Aff Tracker
Posted: Thu Jan 24, 2013 8:25 am
by Vadi
It can help others who'll be looking for the same thing, how about we let it stay?
Re: MiniConsole Aff Tracker
Posted: Thu Jan 24, 2013 8:33 am
by icesteruk
sure .. the fix is below
function init()
winX, winY = getMainWindowSize()
createMiniConsole("aff_display", winX-530,420,510,180)
setBackgroundColor("aff_display", 150, 150, 150, 255)
setMiniConsoleFontSize( "aff_display", 10 )
setFgColor("aff_display", 10, 0, 0)
setBgColor("aff_display", 150, 150, 150)
end
init()
function refreshAffs()
clearWindow("aff_display")
echo("aff_display","\nAfflictions:\n\n")
for k,v in pairs(afflictionQueue) do
if v == true then
echo("aff_display", k.."\n")
end
end
end
and when you tell the system you have healed/been afflicted add refreshAffs() ....
Re: MiniConsole Aff Tracker
Posted: Thu Jul 12, 2018 6:31 am
by thesavage123
Can someone explain to me what else is implied to make this table work?
I have pasted the code into a script file. What else do I need to do to make this work?
Re: MiniConsole Aff Tracker
Posted: Thu Jul 12, 2018 5:00 pm
by Jor'Mox
This code is just a small bit from a larger script, and all it includes is the code needed to create the window and to update the text on it from an existing table. To make something like this fully functional, you would need to have something capturing what affects are on you, and something that triggers the function that updates the window. What all you will actually need is going to depend on what your game provides. Some games provide some back-channel data that could essentially turn this into something that just needs a single trigger/event handler, one that grabs the data, parses it to update the table, and calls the update function. But other games provide none of that information, so you will might want a whole array of triggers to capture specific affect on/off messages, as well as something to grab info when affects are viewed, and likely something to count down remaining durations as time passes, and remove affects once they have expired.