AFFECTS

Thought I'd share a bit of code I use to display all the Prots currently up and their timers
from the MSDP var AFFECTS in a miniConsole window
Firstly you need the "AFFECTS" var in your msdp initialise code
This brings in all the currently active Prots in a Lua table "AFFECTS"
Test that it is working by casting several Prots and typing;
lua msdp.AFFECTS
in the command line. You should get something similar to below
{
rejuvenation = "401",
darksight = "6706",
grace = "384",
["detect invisibility"] = "21649",
aegis = "2177",
class = "-1",
["dark cloak"] = "2177",
["item-generated"] = "-1"
}
You see two odd ones "item-generated" and "class", we will filter them out later.
Prots with white spaces or multi-words are encapsulated in [" "]
Next, create a miniConsole to display all the Prots in (adjust x,y as needed so it sits where you want it)
Here the miniConsole is called "test"
Next, create a new script, call it UpdateSStats
Add a Event Handler msdp.AFFECTS
(type msdp.AFFECTS in "Add User Defined Defined Event Handler:" and click the +)
and add the code as below
The miniConsole should look like the code window below and constantly update.
As a Prot falls it is removed from the table and doesn't display.
Any issues let me know or ask in-game
Linx
from the MSDP var AFFECTS in a miniConsole window
Firstly you need the "AFFECTS" var in your msdp initialise code
- Code: Select all
sendMSDP("REPORT","AFFECTS")
This brings in all the currently active Prots in a Lua table "AFFECTS"
Test that it is working by casting several Prots and typing;
lua msdp.AFFECTS
in the command line. You should get something similar to below
{
rejuvenation = "401",
darksight = "6706",
grace = "384",
["detect invisibility"] = "21649",
aegis = "2177",
class = "-1",
["dark cloak"] = "2177",
["item-generated"] = "-1"
}
You see two odd ones "item-generated" and "class", we will filter them out later.
Prots with white spaces or multi-words are encapsulated in [" "]
Next, create a miniConsole to display all the Prots in (adjust x,y as needed so it sits where you want it)
- Code: Select all
createMiniConsole("test",900,0,420,200)
setMiniConsoleFontSize("test", 9)
setBackgroundColor("test",20,0,0,255)
Here the miniConsole is called "test"
Next, create a new script, call it UpdateSStats
Add a Event Handler msdp.AFFECTS
(type msdp.AFFECTS in "Add User Defined Defined Event Handler:" and click the +)
and add the code as below
- Code: Select all
function UpdateSStats()
clearWindow("test")
for k,v in pairs(msdp.AFFECTS) do
if (k ~= "item-generated") then
if k ~= "class" then
echo("test",string.format("%-20s",string.upper(k))..string.format("%5s",os.date("*t",v).min..":"..os.date("%S",v)).."\n")
end
end
end
end
The miniConsole should look like the code window below and constantly update.
As a Prot falls it is removed from the table and doesn't display.
- Code: Select all
DARKSIGHT 24:16
GREATER FLUIDITY 11:59
DETECT INVISIBILITY 33:19
DARK CLOAK 8:47
AEGIS 8:47
GRACE 22:08
PETRIFIED ARMOR 28:44
IMPROVED HASTE 6:41
Any issues let me know or ask in-game
Linx