XP Calculator and Spell Timer

Posted by Aheram on Mon 27 Dec 2004 03:35 PM — 6 posts, 24,221 views.

#0
I have been searching vainly for something that will calculate how much XP I have gained for a kill. I could not figure out what commands/scripting code to use.

Basically, I will manually type an alias "startxp" that will first enable a COUNTXP1 trigger and then world.send "xp" to the MUD.

CountXP1 trigger is:

^Spare XP: (numbers I want remembered!) (white space!) Experience: (random gibberish!)

Once this matches, I want the client to remember the first wildcard (I will call it XP1) and then turn on a second trigger, called CountXP2, and then turn itself off.

CountXP2 trigger is:

^(You|> You|> > You) killed (.*)\.$

CountXP trigger will world.send "xp" to the MUD, turn on a trigger called CountXP3, and then turn itself off.

CountXP3 trigger is:

^Spare XP: (numbers I want remembered, XP2) (white space!) Experience: (random gibberish!)

Once this matches, the client will take the first wildcard (XP2) and subtract XP1 from it. And then I want the results of XP2-XP1 to be sent into a variable called ExperienceFromKill. It will then do: ansi & "You received @ExperienceFromKill points from @Target." Then finally, it will turn itself off.

So, I know how to do everything else but what to write to calculate the damage.
#1
I just realized I forgot to add questions about Spell Timer in it, too.

Basically, I am planning two different groups of triggers or aliases that related to duration of spells. One will calculate how long a spell lasted (to be able to find the duration) and another will tell me how long the spell will last.

Example:

Alias: starttimer

...will turn on this trigger called StartTimer and turn off a group of triggers/variables called "Spell-Duration."

StartTimer is:
^(You|> You|> > You) are surrounded by a burning shield of fire\.$

Once it matches, it will begin counting seconds. It will also enable triggers called "StopTimer(Fireshield)". It will then turns itself off.

StopTimer(Fireshield) is:

^(The|> The|> > The) fireshield ebbs away\.$

Once that matches, it will stop counting. It will then send the seconds/minutes into a variable called FireshieldDuration. It will then turn itself off.


Spell-Duration Triggers/Variables/Whatever

Once the duration is calculated, I can turn off the triggers above and start using these.

When this trigger is matched:
^(You|> You|> > You) are surrounded by a burning shield of fire\.$

...a timer will start counting that will be subtracted from @FireshieldDuration. That way, it will tell me how much time I have left before the spell ends. It will also turn on the trigger FireshieldEnd.

When I type: aff, it will send these to script.

AnsiNote ANSI (37) & "Fireshield: @SpellFireshield\. Time left: (Results of @FireshieldDuration - Timer count)."


FireshieldEnd is:

^(The|> The|> > The) fireshield ebbs away\.$

Which will reset/stop the timer.
#2
Will this work?

setvariable "ExperienceFromKill", Cint(GetVariable("XP1"))-%1 ?

I am going to try. Haha.
USA #3
To add, subtract, multiply, and divide (and other math functions) you just use the script language's. So usually thats simply '+','-','*', and '/'.

Yes, your subtraction will work.
#4
I was having problems with "overflow." I looked at some other posts and apparently I had to use CLng. That one worked.
USA #5
As for the timer, there's a couple of threads about different aspects of it.

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3362

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4793

Are just a couple, but they should help.

Edit: I see you've already found one of those.