|
teion Wanderer
Joined: 03 May 2005 Posts: 72
|
Posted: Fri Feb 05, 2010 1:55 pm
trouble with sending a line to variable |
greetings. I am trying to make a trigger that sends the new line short room description when I enter a room. Well it works most of the time but I do notice that sometimes only part of the room description is present in the varible
the trigger is
#trigger {^&*~(&*~)} {#if %ismember(%2,@badterms) {#AB} {area = %1};
#if %ismember(%2,@badterms) {#AB} {area2 = %2}}
the variable @badterms contains misc information that i dont want stored into a variable
like (hitched)
(worn)
etc
this is what it looks like when i enter a room
Rohan Lowlands(e, s, n and w)
HP:230 EP:230> ROH s
Rohan Plains(s, n and w) [e and s]
HP:230 EP:230> ROH s
Approaching Edoras(e, s, n and w) [sw and ne]
most of the the time the var @area recieves the information before the () but I notice that some words are not sent such as Lowlands in the above example. Where in the next line Rohan Plains is completly stored in @area
I feel my trigger may be to blame for this. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Feb 05, 2010 2:42 pm |
Your trigger pattern is strange. You are using the & construction, but not naming the variables. If you aren't naming the variables within the pattern, you probably shouldn't use the & construction. As a side note, since your pattern effectively starts with the * wildcard, there's no point in using the ^ pattern. The third issue I see is that you test whether %2 is in @badterms twice, when you could do it all in a single #if statement. In addition, if you don't want to do anything if the statement is true, it is much better to test for the negative of the condition. Try using this trigger instead:
Code: |
#trigger {(*)~((*)~)} {#if (!%ismember(%2,@badterms)) {area = %1;area2 = %2}}
|
If you still have problems with not all of the room description getting into the variable, give us some examples of descriptions that don't seem to work. |
|
|
|
teion Wanderer
Joined: 03 May 2005 Posts: 72
|
Posted: Fri Feb 05, 2010 3:39 pm |
thank you !. worked like a charm and condensed my trigger
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|