|
linenoize Newbie
Joined: 03 Nov 2006 Posts: 3
|
Posted: Wed Jan 10, 2007 4:03 pm
what does $ mean |
In the following line from the manual what does $ do?
#TRIGGER {$} {#T- identify;#IF (!%null(@NewItem)) {#NEW @ItemType @Item}} identify |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 10, 2007 5:54 pm |
$ matches the end of a line. In this case, the end of every line. Quite a strange example.
|
|
|
|
linenoize Newbie
Joined: 03 Nov 2006 Posts: 3
|
Posted: Wed Jan 10, 2007 6:33 pm |
do you know of a good way to pull the numbers out of the following line. I am having the greatest difficulty with it.
Weight [8] Value is [190] Level [22]
Here is what i am using
#TRIGGER {Weight ~[&Item.Weight]} {}
#TRIGGER {Value is ~[&Item.Cost]} {}
#TRIGGER {Level ~[&Item.Level]} {}
which yields:
8] Value is [190
190] Level [22
22 |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Wed Jan 10, 2007 8:41 pm |
Looks like the trigger is being greedy. Could save the variables in the action field instead
#TRIGGER {Weight ~[(%d)~]} {Item.Weight = %1}
#TRIGGER {Value is ~[(%d)~]} {Item.Value = %1}
#TRIGGER {Level ~[(%d)~]} {Item.Level = %1} |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 10, 2007 9:39 pm |
You could just use one line too - {Weight ~[(%d)~] Value is ~[(%d)~] Level ~[(%d)~]}
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jan 10, 2007 11:09 pm |
Why not combine the best of both worlds? &varname syntax allows for a cast, using simple wildcards:
&%dvarname -- only captures numbers, placing them directly into the @varname variable
&%wvarname -- only captures letters in a single word format (ie, it will capture "hand" in "hand-me-downs" or "abc" in "abc123")
&%avarname -- ditto, but matches any one-word combination of numbers and letters
&%xvarname -- ditto, but matches any one-word combination of non-whitespace
&*varname -- this might not actually work, but theoretically it's equivalent to &varname
&%nvarname -- matches only comma-delimited numbers
&%tvarname -- matches only on valid directions
&%svarname -- matches only on whitespace (although why bother assigning it to a variable?)
&%pvarname -- matches only on punctuation
Some of the above might not work, and the same goes for the ones I didn't mention (%q, %y). The same goes for the more complicated stuff like stringlist patterns ({string|list|here}) and range patterns ([%w%s]), though I suspect these won't work as they aren't exactly wildcards. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Wed Jan 10, 2007 11:19 pm |
Coo, didn't know about that myself. Ta ;)
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jan 11, 2007 1:43 am |
I always hated that syntax though :( I don't like the idea of my triggers doing something permanent that I can't easily see in in the script box. Thankfully, ($localvar:wildcard) in CMUD and the new events system have rendered it pretty much obsolete :)
|
|
|
|
|
|