Reading in values to a variable

by Serrin

Back to Mechanic's Corner.

Serrin2006-01-26 03:00:33
I know Ethelon's system does it to update your hp/mana/ego maxes and I'm sure if I dove into his code I could figure out how he does it.

I'm hoping to go the easy route and get someone to tell me ;P.

I'm looking to read the # values for damage/precision/speed when doing a WP into seperate variables and have then update anytime I do a WP.
Unknown2006-01-26 03:38:35
Using VBScript:

Make a trigger with pattern:
^Damage\\: (\\d+) Precision\\: (\\d+) Speed\\: (\\d+)$

Turn on flags (there may be extras, someone else fix): enabled, keep evaluating, reg expression

Send box:
world.setvariable "Damage", %1
world.setvariable "Precision", %1
world.setvariable "Speed", %1

And have it SEND TO script.
Tada! That should work...
Serrin2006-01-26 03:45:12
Thanks, I'll give it a try.
^Damage\\: (\\d+) Precision\\: (\\d+) Speed\\: (\\d+)$
should that all be \\d+ ? How is it storing the different values so that it doesn't just plug the same value in for each variable?
Unknown2006-01-26 03:47:22
More like:

world.setvariable "Damage", %1
world.setvariable "Precision", %2
world.setvariable "Speed", %3

And yes, \\d+ stands for 'one or more digits'.
Unknown2006-01-26 04:18:41
mreh, its late. My bad.


NOW it should work right.
Serrin2006-01-26 06:01:32
Cool, thanks.

Another question now:

Ethelon uses a BALCHECK trigger for checking with balance (I'm not really sure how it stores whatever).

How could I tie in to that so that I can setup a trigger that'll fire after the trigger line gets thrown and balance is recovered (like when you finish forging a weapon).
Serrin2006-01-26 07:21:38
Hmmm, it doesn't seem to be working.

I go and check the variables after performing a WP and they don't change at all.
Shryke2006-01-26 07:25:39
just add a trigger to pick up the sword after the forging message ends, have it forge on each balance, then once you're all out of balances, it will pick it up, when you do that fire your stat alias, then if it's no good, execute a reforge alias, and you should be rollin.. dunno if that answers the question.
Serrin2006-01-26 07:53:41
Woot! figured it out on my own (well, what I was missing).

i need (/d.+) and then it began working.

Still having an issue with grabbing the item after the forging is complete though.
Shryke2006-01-26 07:59:57
just do this (this is zmud but still isnt that hard to transfer)
#trigger {has reached the highest} {get sword from forge;wp sword}
Unknown2006-01-26 08:06:57
QUOTE(Serrin @ Jan 26 2006, 07:53 AM)
Woot! figured it out on my own (well, what I was missing).

i need (/d.+) and then it began working.

Still having an issue with grabbing the item after the forging is complete though.
250455



You probably need the period after the last stat, in which case it should be "(\\d+)\\." or else you'll get the period in one of your variables.
Serrin2006-01-26 08:10:20
You're not on balance when that trigger would fire though Ciaran, you can't pick something up out of the forge while off balance.
Unknown2006-01-26 09:01:56
Make 2 triggers: one to fire on the last forging message and one to fire on balance recovery. Make both triggers disabled by default. Enable the first trigger when you start forging and make it disable itself and enable the balance trigger when firing. Make the balance trigger disable itself and pick up the weapon. Something like:

CODE


 sequence="100" send_to="12">
 
 world.EnableTrigger "forge_complete", 0
 world.EnableTrigger "forge_balance_recovered", 1
 



 regexp="y" sequence="100" keep_evaluating="y" send_to="12">
 
 world.EnableTrigger "forge_balance_recovered", 0
 world.Send "get weapon" + vbCRLF + "wp weapon"
 





You can enable the first trigger either from some forging alias, or if you are lazy - just enable it by default, it won't do too much damage.
Serrin2006-01-26 10:00:44
Thank's avator, I didn't think that way.

I got it all working the way I want it now, I'm happy ^^.

Thanks everyone else who helped too

EDIT: Could someone tell me if I have something wrong in this:

if ((getvariable ("damage") < getvariable (forge_damage)) AND (getvariable ("precision") < getvariable("forge_precision")) AND (getvariable ("speed") < getvariable (forge_speed))) then

damage, precision, and speed have their values passed in when I wp something, forge_whatever are constants that I set (denoting minimum values that I want).

This SHOULD be checking to see if the stats on the weapons are lower than the stats I desire, and it'll then smelt the item and reforge. But the if-then statement doesn't seem to be firing.

when you do getvariable does it return an integer value if that is what is being stored?

edit2: Doh, stupid quotation marks... lemme change that and see if it starts working