|
zogalogran Beginner
Joined: 23 Jun 2006 Posts: 20
|
Posted: Mon Feb 20, 2012 8:35 pm
basic variable capture in #TR |
I've been reading the docs, and scouring examples - but I still get an illegal token error on this:
#TR nameline {^&{name} can be referred to as &{tags}}{#EC @name @tags} idscripts
I'm just starting the basic outline of an identify DB script, and all I want to be able to do at the moment is:
1) Create a trigger on the fly
2) Have it respond to the text above
3) Store @name and @tags, and spit them out to me in an echo so I can see that it works.
What am I doing wrong? |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon Feb 20, 2012 8:59 pm |
You're missing a space between the } to end the pattern and the { to start the code. This should work:
Code: |
#TR nameline {^&{name} can be referred to as &{tags}} {#EC @name @tags} idscripts |
|
|
|
|
zogalogran Beginner
Joined: 23 Jun 2006 Posts: 20
|
Posted: Mon Feb 20, 2012 9:03 pm |
Wow, my newbness knows no bounds. Thank you. It works now, but I don't see any echo output. What other idiocy have I committed?
Can I add a bit more complexity here too?
So I have an alias (id) that will:
1) create a bunch of triggers that will handle the parsing
2) actually cast id on %1
3) shoot the data into the db
4) untrigger everything
In addition to not seeing the #EC output (which is where I would hope to make sure I have the data properly stored so I can do any additional parsing and send it to the db), the "trigger removed" echo shows up before the actual id output from the mud. Is that normal? Seems like if the trigger is removed, it won't be responding to the output...
Thanks in advance. |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Mon Feb 20, 2012 9:28 pm |
The echo worked fine for me, so it's likely the trigger just isn't firing. Try going to the pattern tab of the trigger you just created and put the line you're testing with in the test box. Does the pattern match? EDIT: If it doesn't, can you include some sample mud output, so we can help you make a pattern?
As for your alias, that is normal, because nowhere in there do you tell it to wait until the mud has sent the id output and the triggers have fired. You'd want to put the untriggers in the triggers themselves, after they do whatever it is they need to do. However, I don't recommend adding and removing triggers every time, because that's very inefficient - it would be much better to keep them permanently and just enable/disable them as required, with the #T+ and #T- commands. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Feb 21, 2012 12:27 am |
Daern is correct, the better way to do this would be to permanently create all of the triggers in the idscripts class and have your alias enable the class with
The trick will be how to disable the class when you are done. I am assuming that the output of your id spell could have several lines, and you want the the triggers to catch all of the lines and collect the data. If your id spell output always ends with a particular line, then you could trigger off of that line. If the spell does not have a consistent ending line, then you will probably have to trigger off of your prompt. Make a trigger in idscripts which matches on your prompt (i.e. ">" or whatever prompt your mud gives when it is waiting for input). Set this trigger to "Trigger on Prompt", and have the trigger execute "#T- idscripts". |
|
|
|
zogalogran Beginner
Joined: 23 Jun 2006 Posts: 20
|
Posted: Sun Mar 04, 2012 4:42 pm |
Thanks Rahab. I just saw this response and it solves a number of problems for me.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Mar 04, 2012 5:44 pm |
If you get a blank line at the end of the spell and before the prompt, I'd have a blank line trigger in your class to do the disabling instead.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|