Variables...

Posted by Hoss on Wed 30 Mar 2005 01:32 AM — 8 posts, 30,605 views.

USA #0
Alright I'm trying to match on:

Wood 8 gp 0 30 gp

so I created a trigger which is:

Wood * * gp * * gp

Which should then:

world.setvariable "woodprice", "%2"

But the problem is that my variable ends up getting:

8

Which I'm trying to do is match on the 8 but I don't want all the spaces... Any ideas?

Thanks

Hoss
USA #1
Sorry aperently the spaces didn't show but in the line with:
Wood 8 gp 0 30 gp

There is 5+ spaces bewteen every part except the gp after the numbers..

Hope that helps

Hoss
USA #2
Sorry again but the Variable I get has a bunch of spaces before the 8

Thanks Again
Hoss
USA #3
You can use code tags [code] and [/code] to retain spacing. (And you can edit posts, instead of having to post a bunch of new ones).
Amended on Wed 30 Mar 2005 04:23 AM by Flannel
USA #4
Hmm I must have missed that then... So how do you edit post?

Alright here's what I'm trying to match on:

Wood                      50 gp            1035          100 gp


so I have been using a trigger which was:

Wood * * gp * * * * gp

I was hoping that it would match the spacing and such... but it hasn't been any ideas on how to match that piece of code?

Hoss
USA #5
Use Regular expressions.

And to edit a post, log in and click the edit button on the post (next to delete, which is next to the time). You need to be logged in (which also means you don't have to enter your name/password each time you want to post). You log in in the upper right corner.
USA #6
Oh yeah, and the trigger:

^Wood[ ]+(\d+) gp[ ]+(\d+)[ ]+(\d+) gp$
(remember to check the "regular expression" box)
should match (you might need to have a space infront of wood or behind the last gp.

This will make %1 the first number, %2 the second, and %3 the third.
USA #7
Thank you Flannel! That's exactly what I needed THANK YOU!


Hoss