hopelessly lost

Posted by Littlebear on Wed 24 Oct 2007 11:38 AM — 5 posts, 19,940 views.

USA #0
I have searched and haven't found anything that resembles my problem so i will try to explain what i am trying to do, heh.

The mud i play doesn't say "You gained 250 exp" when you kill a mob, what i am trying to do, is have the xp stored in a variable then when i kill something, makes the xp into another variable, subtracts the first one and says "you gained x exp" then stores the second one as the first.

the command to get the total exp is "xp" and the line is:

Your current experience points: xxxx

i hope that sounds rational, not good at explaining things too well.
Australia Forum Administrator #1
What does it say when you kill a mob, exactly?

I would make a trigger on that message, eg.

Match: You have killed *

That trigger would send the "xp" command to the MUD.

Then when you get the message:

Your current experience points: xxxx

You have a trigger, eg.

Match: Your current experience points: *

This trigger has a script that subtracts that from the previous xp value, and displays the difference. It then saves this as the new value.
USA #2
I follow you up until the subtracting part, i don't know how to make it subtract and store the new number.

when something dies the match is:

* dies in fits of twitching agony.

#3
Try this:


<triggers>
<trigger
enabled="y"
match="* dies in fits of twitching agony."
send_to="12"
sequence="100"
>
<send>EnableTrigger("xpgain", true)
Execute("exp")</send>
</trigger>
<trigger
match="Your current experience points: *"
name="xpgain"
omit_from_output="y"
send_to="14"
sequence="99"
>
<send>Note ("You have gained ", tostring(tonumber(%1) - tonumber(GetVariable("XP"))), " XP.")
SetVariable("XP", "%1")
EnableTrigger("xpgain", false)</send>
</trigger>
<trigger
enabled="y"
match="Your current experience points: *"
name="xp_set"
send_to="12"
sequence="100"
>
<send>SetVariable("XP", %1)</send>
</trigger>
</triggers>
#4
Oh, also make sure scripting is enabled and set to Lua. If you don't normally use Lua, you can just use the plugin wizard to export it as a plugin.