A nice simple GMCP quest tracker plugin I wrote to track quest average, total quests and to tell me total qp when I complete a quest, all modifiers included through GMCP
Enjoy! :)
- Gedeon
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Quest_Tracker"
author="GIDEON_THE_BIBLE_BOOK_JUDGES"
id="0594aa70c008365aa5070abc"
language="Lua"
save_state="y"
date_written="2018-10-13"
requires="4.98"
version="2.11"
>
</plugin>
<include name="constants.lua"/>
<aliases>
<alias
match="gmcpquest"
enabled="y"
send_to="12"
sequence="100"
>
<send>
QuestCounter = GetVariable("QuestCounter")
QuestCounter = tonumber(QuestCounter)
print(QuestCounter, "Quests Completed")
QPtotal = GetVariable("QPtotal")
QPtotal = tonumber(QPtotal)
print(QPtotal, "QP total quest points with plugin")
print(tonumber(GetVariable("QPtotal"))/tonumber(GetVariable("QuestCounter")), " QP Average")
</send>
</alias>
</aliases>
<script>
require "serialize"
function OnPluginBroadcast (msg, id, name, text)
if (text == "comm.quest") then -- if we receive some GMCP quest data then do the following block of code up to end of if statement
res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264", "gmcpval", "comm")
luastmt = "gmcpdata = " .. gmcparg
assert (loadstring (luastmt or "")) ()
local action = gmcpval("quest.action")
if (action == "comp") then -- begin is statement with then
LastQuestQPTotal = GetVariable("LastQuestQPTotal")
LastQuestQPTotal = gmcpval ("quest.totqp")
print (LastQuestQPTotal, " QP from quest")
SetVariable ("LastQuestQPTotal", LastQuestQPTotal)
QuestCounter = GetVariable("QuestCounter")
QuestCounter = tonumber(QuestCounter)
QuestCounter = QuestCounter + 1
SetVariable ("QuestCounter", QuestCounter)
print(QuestCounter, " Quests Completed with GMCP_Quest_Recorder")
QPtotal = GetVariable("QPtotal")
QPtotal = tonumber(QPtotal)
QPtotal = QPtotal + LastQuestQPTotal
SetVariable ("QPtotal", QPtotal)
print(QPtotal, "Quest Points earned with GMCP_Quest_Recorder")
print(tonumber(GetVariable("QPtotal"))/tonumber(GetVariable("QuestCounter")), " QP Average")
end -- end if statement
end -- if gmcp quest data receieved comm.quest
end -- function onpluginbroadcast
require "gmcphelper" -- this line is necessary for us to be able to use the gmcpval helper function defined in gmcphelper.lua
function OnPluginInstall ()
QuestCounter = tonumber(GetVariable("QuestCounter"))
if QuestCounter == nil then
SetVariable ("QuestCounter", "0")
QuestCounter = tonumber(QuestCounter)
end
QPtotal = tonumber(GetVariable("QPtotal"))
if QPtotal == nil then
SetVariable ("QPtotal", "0")
QPtotal = tonumber (QPtotal)
end
end
function OnPluginSaveState() -- begin OnPluginSaveState function block, NOTE : VARIABLES MUST BE SAVED AS TYPE STRING TO SAVE CORRECTLY AND THEN CONVERTED BACK TO NUMBERS during OnPluginInstall function as demonstrated above
SetVariable("QuestCounter", QuestCounter)
if QPtotal == nil then -- begin if statement with then
SetVariable("QPtotal", "0")
QPtotal = tonumber(QPtotal)
end
end -- end OnPluginSaveState function block
</script>
</muclient>
Enjoy! :)
- Gedeon