Page 1 of 1

numeric variable tracking

Posted: Mon May 24, 2010 8:20 pm
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

Re: numeric variable tracking

Posted: Tue May 25, 2010 2:52 am
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)

Re: numeric variable tracking

Posted: Tue May 25, 2010 9:24 pm
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.