|
qdly Beginner
Joined: 26 Jun 2009 Posts: 13
|
Posted: Mon Aug 16, 2010 2:56 pm
2 short questions |
1st:
i'v exit string containing
[exits: N{0 virtualc} E{0 virtualc} S{0 virtualc} W{0 virtualc} U{0 virtualc}]
and i want to #sub, those are vnum and map name, so i'v made trigg:
~{0 virtualc~} #sub, i'v checked repeat within line, trigger on trigger(not rly needed), and trig on newline, kinda works, result is:
[exits: N E{0 virtualc} S W{0 virtualc} U]
not exacly what i wanted, any sugestions?
2nd:
another one is related, lets assume i'v made it thrue with those vnums, and my line is
[exits: N E S W U], but can be as well [exits: N] or [exits: N E] (diffrent amount of exits
i would love to get them all in %1, %2, %3 and so on vars, so i can use them easly, but i'v no idea how to make trigg work with changable amount of variables, trig on ~[exits: &{%w}~] would work for one exit, but wont for 2 or more, if i make it for max, lets say 7 exits the same way (~[exits: &{%w} &{%w} &{%w} .... ~]), it wont run if there is less of them, and if i use %a i will get string looking like N E S W D U whatever, iv to deal with, what makes it much harder, any way to make it work with %1-%99 vars?
thanks for help |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Aug 16, 2010 6:18 pm |
1) Please post the actual code you are using. In the Package Editor, open the specific trigger. Click the XML tab at the bottom of the code. Highlight the code. Type CTRL-C to copy it. Post a reply here in the forum. In the reply, type
Then type CTRL-V to paste your code.
Then type
after your code, so that the forum will retain the exact spacing. Without seeing your actual code, it is extremely difficult to debug it.
2) The easiest way to deal with this is to capture the entire list of exits, e.g. "N E S W U", into a single string, then turn it into a stringlist. Then you can do whatever you want with the stringlist, using constructs such as #FORALL, or %item(). The following code will turn the local string variable $myvar into a stringlist:
Code: |
$myvar = %replace($myvar," ","|") |
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Aug 17, 2010 12:05 am |
#1 will probably be solved using the Repeat within line option for triggers.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
qdly Beginner
Joined: 26 Jun 2009 Posts: 13
|
Posted: Tue Aug 17, 2010 10:37 pm Re: 2 short questions |
MattLofton wrote: |
#1 will probably be solved using the Repeat within line option for triggers. |
qdly wrote: |
1st:
(...) i'v checked repeat within line (...) |
doesnt solve /
1)
Rahab, her it goes:
Code: |
<trigger priority="2000" repeat="true" id="217">
<pattern>~{0 virtualc~}</pattern>
<value>#sub</value>
</trigger>
|
2) thanks, thats good enough for me for now, but still is there any way to make trigger for words that not always appear? i had similar problem with prompt line, where at the end, while fighting i'v monster health in %, and while i'm out of combat there is nothing, so status bar looks
[xxxxxxx](100%) - in combat, full monster hp
[xxxxxxx] - out of combat
sure, i can set trigger for ~[xxxxxxx~]* but can't use that (100%) in script without making another trig for ~[xxxxxxx~](&{%n}~%), or sth like that |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Aug 18, 2010 1:31 pm |
1) Hm. Try changing "#sub" to "#sub {}". I haven't tried using #sub without an argument, and I I'm afraid I don't have cmud installed on this computer to test it.
2) Yes, there is a way, but it requires using regex patterns rather than zscript patterns. See the documentation for details on how to use regular expressions. For this specific situation, you could use a regex pattern of:
If you use a regex pattern, be sure to mark the box on the trigger saying it is a regex pattern. |
|
|
|
qdly Beginner
Joined: 26 Jun 2009 Posts: 13
|
Posted: Tue Sep 28, 2010 11:26 pm |
1) i'v used %replace instead, works every time.
2) somehow i'v found easy sollution,
[xxxxx]{&*|} works nice for it. |
|
|
|
|
|
|
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
|
|