Dragish
Posts: 6
|
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE muclient> <!— Saved on Thursday, July 17, 2008, 5:23 PM —> <!— MuClient version 4.14 —> <!— Plugin "TokenCalculator" generated by Plugin Wizard —> <muclient> <plugin name="TokenCalculator" author="Selig" id="b612cd78a124e14cd59fc3ab" language="Lua" purpose="Estimate the value of archon tokens in inventory or container" save_state="y" date_written="2008-07-17 17:21:52" requires="4.01" version="1.0" > </plugin> <!— Get our standard constants —> <include name="constants.lua"/> <!— Triggers —> <triggers> <trigger enabled="y" group="token_calc" keep_evaluating="y" match="^.* contains:" name="cont_reset_token" regexp="y" script="ResetArchonTokenCount" sequence="100" > </trigger> <trigger enabled="y" group="token_calc" omit_from_output="y" keep_evaluating="y" match="^A total of.*items" name="est_tokens" regexp="y" script="EstimateArchonTokens" send_to="14" sequence="100" > </trigger> <trigger enabled="y" group="token_calc" keep_evaluating="y" match="^You are carrying:" name="inv_reset_token" regexp="y" script="ResetArchonTokenCount" sequence="100" > </trigger> <trigger enabled="y" group="token_calc" keep_evaluating="y" match="^(.*) a (.*) token.*" name="inv_token" regexp="y" script="AddArchonTokens" sequence="100" > </trigger> </triggers> <!— Script —> <script> <![CDATA[ ArchonTokenCount = { ["golden"]=0, ["obsidian"]=0, ["crystal"]=0, ["admantite"]=0, ["copper"]=0, ["platinum"]=0, ["hexagonal silver"]=0 } ArchonTokenInfo = { ["golden"]={ ap=17, pp=4, gp=0, qp=0 }, ["obsidian"]={ ap=13, pp=3, gp=0, qp=0 }, ["crystal"]={ ap=94, pp=0, gp=0, qp=0 }, ["admantite"]={ ap=138, pp=0, gp=0, qp=0 }, ["copper"]={ ap=39, pp=0, gp=0, qp=39 }, ["platinum"]={ ap=40, pp=0, gp=60000, qp=0 }, ["hexagonal silver"]={ ap=145, pp=14, gp=0, qp=167 } } function AddArchonTokens(name, line, wildcards) num = 1 type = Trim(wildcards[2]) if ArchonTokenInfo[type]~=nil then for item in string.gmatch(wildcards[1], "%d+") do num = tonumber(item) end ArchonTokenCount[type] = ArchonTokenCount[type] + num end end function ResetArchonTokenCount(name, line, wildcards) for k,v in pairs(ArchonTokenCount) do ArchonTokenCount[k]=0 end end function EstimateArchonTokens(name, line, wildcards) — display original line for _, v in ipairs (TriggerStyleRuns) do ColourTell (RGBColourToName (v.textcolour), RGBColourToName (v.backcolour), v.text) end — for each style run Note() — analyse tokens ap = 0 pp = 0 gp = 0 qp = 0 for k,v in pairs(ArchonTokenCount) do token = ArchonTokenInfo[k]; if token~=nil then ap = ap + (v * token.ap) pp = pp + (v * token.pp) gp = gp + (v * token.gp) qp = qp + (v * token.qp) else Note("Token " .. k .. " not recognised.") end end if ap~=0 or pp~=0 or gp~=0 or qp~=0 then — output estimate of token value ColourTell ("blue","black","Archon tokens worth approximately ") ColourTell ("silver","black",ap) ColourTell ("blue","black"," AP, ") ColourTell ("silver","black",pp) ColourTell ("blue","black"," PP, ") ColourTell ("silver","black",qp) ColourTell ("blue","black"," QP and ") ColourTell ("silver","black",gp) ColourNote ("blue","black"," GP.") end end ]]> </script> </muclient> now the issue with this is that its not evaluating all the tokens i have and combining them together to give totals, but evaluating the last token in each group ie, platinum for gold, obsidian for pracs instead of obsidian and gold tokens combined. i dont know how to do this last step. |
i have a basic token script and it goes like this (its from someone else)