|
darkspot Apprentice
Joined: 29 Jul 2002 Posts: 105
|
Posted: Fri Feb 20, 2004 10:35 am
Multi Line Capture |
I want to get a few lines, that if they appear, (if not the trigger just won't fire so won't be too complex... I hope) they all go into a single variable. This is an example of the text from the mud
Affects:
Damroll by 1.
Hitroll by -1.
Is rust proof
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I want the trigger to be able to take any and all affects (there may be more, or less, but it always shows up in a list like that) and puts it all in a single variable. such as
#var affects {Damroll by 1., Hitroll by -1., Is rust proof} |
|
|
|
szeming Newbie
Joined: 18 Feb 2004 Posts: 7 Location: Hong Kong
|
Posted: Fri Feb 20, 2004 11:13 am |
If there always only have 3 lines following,
I will use this method :P
trigger 1,
pattern:
Affects:
value:
#t+ recordaffects
i=0
trigger 2 in recordaffects class,
pattern:
(*)
value:
#math affects @affects+%1
#math affects @affects+,
#math i @i+1
#if @i=3 {#t- recordaffects}
that's my suggestion,
hope can help u |
|
|
|
darkspot Apprentice
Joined: 29 Jul 2002 Posts: 105
|
Posted: Fri Feb 20, 2004 11:42 am |
the problem is, it's an undetermined number of lines after affect
It might just be one line following, or.. I haven't found the max... so far 3 is the most I've seen, but I haven't seen too many yet. |
|
|
|
darkspot Apprentice
Joined: 29 Jul 2002 Posts: 105
|
Posted: Fri Feb 20, 2004 11:48 am |
hrm, that just gave me an idea though....
#trigger {Affects:} {#t+recordaffects; #var affects {} }
#trigger {(*)} {#if (%1 = "") {#t- recordaffects} {#var affects {@affects, %1} } }
problem is... can you have a class in a class (the first trigger is going to be in part of an "identify" class... I'll find out, thanks for the inspiration.. I'll test this all out tomorrow... I'm tired at this moment. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 20, 2004 5:18 pm |
Yes, multi-level classes have been supported since early in version 6.xx. #T+ and #T- also work with setting IDs, so it's not necessary to create a new class just to control one setting.
Here's a single-trigger solution, using a multistate trigger with ID. It's been tested offline, using simulated MUD output, and appears to work.
#TR recordaffects {Affects:} {#VAR affects {}}
#COND {} {#IF (%len( %trigger) > 0) {#IF (%len( @affects) > 0) {#VAR affects {@affects, %trigger}} {#VAR affects {%trigger}}} {#STATE recordaffects 0}} {Looplines|Param=99} |
|
|
|
darkspot Apprentice
Joined: 29 Jul 2002 Posts: 105
|
Posted: Fri Feb 20, 2004 7:53 pm |
just curious... the trigger isn't in the "recordaffects" class.... what does putting that name before the rest of the trigger do? Also how can you tell when the conditional will fire? and where is it in all the trigger section?
thanks. just trying to understand things so I can do em better myself later :) |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Feb 20, 2004 8:45 pm |
#TR recordaffects {Affects:} {#VAR affects {}}
----------^ ID name for trigger
One of the great benifits is you can enable and disable this trigger by using its ID
#t- recordaffects
But there is alot more you can do with ID names
If the ID is present, then the trigger is created with the given short name. Otherwise the name for the trigger is the same as the pattern. IDs are useful for giving short names to complicated trigger patterns, or for creating multiple triggers with the same pattern. |
|
|
|
darkspot Apprentice
Joined: 29 Jul 2002 Posts: 105
|
Posted: Sat Feb 21, 2004 12:17 am |
so basically you can use id's like a class? or make it so inside a class you can turn certain trigs on and off? very very nice. thanks, that is very useful. any other cool things about the id tags I may want to know?
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Feb 21, 2004 2:43 am |
Yup if your using (mostly for) Temp triggers or Temp alarms you can assign them an ID name and if the trigger or alias or what not double fires it will overwrite the previous one so you don't get a million of at one time
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Feb 21, 2004 4:00 am |
IDs provide an easy way of referring to a particular trigger (or other setting). One use which hasn't been mentioned is the one demonstrated here, controlling a multi-state trigger. Because the trigger has an ID, it's easy to tell the #STATE command which trigger to set to state 0.
As for your other questions, since the #CONDITION pattern is blank it will fire on every line as long as its active. The #IF checks for a blank line and resets the trigger when it encounters one, otherwise the trigger will reset after 99 lines. The effect of a blank pattern does vary by the condition-type though, so it's important to check Help before using it with a condition-type you aren't familiar with.
The #CONDITION is part of the trigger above it. To see it (or edit it) in the Settings Editor, change the trigger State (small box on top-right) from 0 to 1. It's also shown on the States tab, but it's usually better to use the Pattern tab for editing. |
|
|
|
Oofy Newbie
Joined: 25 Jan 2004 Posts: 3
|
Posted: Sun Feb 22, 2004 4:26 am |
I'm also trying to capture multiple lines, such as tells, to be sent to another window. The number of lines vary, and I'd like to be able to capture only the text sent in the tell. Is there a way to add a command line to a window as well?
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Feb 22, 2004 5:51 am |
I hope you succeed, but there's quite a difference between capturing affects to a variable and capturing tells to a window. The latter has been done frequently, so if you use the Search link you can probably find something a lot closer to what you're looking for. If not, it would be more appropriate for you to start a New Topic instead of trying to hijack someone else's thread and change the topic.
|
|
|
|
Oofy Newbie
Joined: 25 Jan 2004 Posts: 3
|
Posted: Sun Feb 22, 2004 6:32 am |
I'm sorry
quote: Originally posted by LightBulb
I hope you succeed, but there's quite a difference between capturing affects to a variable and capturing tells to a window. The latter has been done frequently, so if you use the Search link you can probably find something a lot closer to what you're looking for. If not, it would be more appropriate for you to start a New Topic instead of trying to hijack someone else's thread and change the topic.
|
|
|
|
|
|