|
yeedoo Beginner
Joined: 13 Dec 2007 Posts: 16
|
Posted: Wed Jan 09, 2008 2:07 pm
question about the type of VARIABLE |
for example
Code: |
#class aaa {}
#var fc_n
#TRIGGER {^(*)%s/(*)%s~(+(*)~)} {
fc_n=%1
}
#class 0 |
now if %1=700
in another class ,i write
Code: |
#math a @fc_n+500
#show @a |
700 500 was shown on
obviously it's not my mean ,it's more like the two strings were concated.
so i replace the (*) with (%d),it's ok
i don't konw what's wrong ,VARIABLE's type changed ? |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Wed Jan 09, 2008 2:17 pm |
I barely understand what you're trying to say but.
I just tried with two pseudoclasses in my system.
I named on to 'aaa' and wrote a variable inside of it, fc_n and gave it a value of 200.
Then I made second class, named it 'aaa1' and put a variable that I called 'a' there.
To the "script part" of the Variable a, I wrote
And chose it not to be text but Zmud script. Then I hit Save.
When I now use Command Line and type #show @a it shows me 700 as its supposed to.
Prog |
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Wed Jan 09, 2008 3:22 pm |
Keep the wildcard as %d rather than * since if that does actually match and store your value correctly then not only is it faster but it's also the correct way to match numbers.
|
|
_________________ Taz :) |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jan 09, 2008 4:55 pm |
Taz nailed it. Ninjaed again ;)
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 09, 2008 5:54 pm |
Mmm, the probable cause is that the * wildcard is being greedy and capturing all but one of the spaces at the end (which will be matched by %s since %s is the regex \s+ and not \s*). "700 " is a string but "700" is probably a number.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jan 09, 2008 9:09 pm |
So, to encapsulate this...
Here is what you SHOULD have (This worked right for me)
Code: |
#class aaa {}
#var fc_n
#TRIGGER {^(%d)%s~/(%d)%s~(+(%d)~)} {
fc_n=%1
}
#class 0
#math a @fc_n+500
#show @a
|
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|