numeric variable tracking

Post Reply
Verthar
Posts: 10
Joined: Tue Apr 27, 2010 3:12 pm

numeric variable tracking

Post by Verthar »

Ok, I have no idea how this would even work so I'm asking. I want to use this for tracking simply how much gold I acquire in a constant fashion, able to bring up my total just by an alias command. However I would also think I could extend it to various other sorts of variables as well. I.E. How many sips in a container, shard weight totals, etc. At least a starting point would be much appreciated

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: numeric variable tracking

Post by demonnic »

You'll want an alias to turn the tracking on/off, one to reset it, and one to display the totals.

The one to turn it on/off could be


pattern:^gtrack(?: )?(on|off)$

script:
Code: [show] | [select all] lua
if matches[2] == "on" then
  goldtracking = true
  return
elseif matches[2] == "off" then
  goldtracking = false
  return
else
  if goldtracking then 
    goldtracking = false
    return
  else
    goldtracking = true
    return
  end
end
the one to reset it might be


pattern: ^greset$
script:
Code: [show] | [select all] lua
goldvariable = 0

and the one to display it could be

pattern: ^gdisp$
script:
Code: [show] | [select all] lua
cecho("<red>You have earned <gold>" .. goldvariable .. " <red>gold this session, since the last reset")


All that would remain, then, is to setup trigger to catch how much gold you pick up/earn and have it add the amount to goldvariable . (which I suggest you rename across the board to something else, I used it as a standing)

Verthar
Posts: 10
Joined: Tue Apr 27, 2010 3:12 pm

Re: numeric variable tracking

Post by Verthar »

hrm, maybe this isn't worth the effort. I'm pretty bad at scripting, especially with Mudlet, doing the change from Nexus. Thank for your help, maybe when I have more patience I'll try figuring out how to make a trigger to help track it.

Post Reply