MiniConsole Aff Tracker

Post Reply
icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

MiniConsole Aff Tracker

Post 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..
Code: [show] | [select all] lua



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
}
Attachments
pic of the error
pic of the error
forumspic.jpg (20.89 KiB) Viewed 5115 times

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: MiniConsole Aff Tracker

Post by icesteruk »

can someone please delete this post/topic..

I found the problem was missing a

if v == true then - working good now

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: MiniConsole Aff Tracker

Post by Vadi »

It can help others who'll be looking for the same thing, how about we let it stay?

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: MiniConsole Aff Tracker

Post by icesteruk »

sure .. the fix is below

Code: [show] | [select all] lua

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() ....

thesavage123
Posts: 2
Joined: Thu Jul 12, 2018 6:29 am

Re: MiniConsole Aff Tracker

Post 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?

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: MiniConsole Aff Tracker

Post 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.

Post Reply