 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Sep 11, 2008 2:08 pm
Triggers that have stopped working |
It seems again that I have triggers that worked, that have NOT been changed, and yet they work no longer.
Well... that isn't wholly true. The two triggers I have found in error work on my other connections, but not on any new connections I've made, even though there is NO difference.
| Code: |
#TRIGGER thirsty {^You are thirsty.$}
{
#SWITCH (@posn)
("wake") {#5 {#send "drink decan"}}
("rest") {#5 {#send "drink decan"}}
("sleep") { #IF (@regen=1) {#wait 5000;#5 {#send "drink decan"}} {#send rest;#5 {#send "drink decan"};#send {sleep}}}
} {General Triggers}
#REGEX Tick_Regen {^TICK IN 5 SECONDS.$} {#if (@regen) {
#switch (@posn)
("rest") {#SAY "waiting...";#WAIT 2000;sleep}
("wake") {regen=0;#say Regen Off}
("sleep") {regen=0;#say Regen Off}
} } {General Triggers}
|
XML of non-working/working in that order.
| Code: |
<trigger name="Tick_Regen" priority="240" regex="true" id="24">
<pattern>^TICK IN 5 SECONDS.$</pattern>
<value>#if (@regen) {
#switch (@posn)
("rest") {#SAY "waiting...";#WAIT 2000;sleep}
("wake") {regen=0;#say Regen Off}
("sleep") {regen=0;#say Regen Off} }</value>
</trigger>
<trigger name="Tick_Regen" priority="2920" regex="true" id="292">
<pattern>^TICK IN 5 SECONDS.$</pattern>
<value>#if (@regen) {
#switch (@posn)
("rest") {#SAY "waiting...";#WAIT 2000;sleep}
("wake") {regen=0;#say Regen Off}
("sleep") {regen=0;#say Regen Off}
}</value>
</trigger>
<trigger name="thirsty" priority="190" id="19">
<pattern>^You are thirsty.$</pattern>
<value> #SWITCH (@posn)("wake") {#5 {#send "drink decan"}}("rest") {#5 {#send "drink decan"}}("sleep") { #IF (@regen=1) {#wait 5000;#5 {#send "drink decan"}} {#send rest;#5 {#send "drink decan"};#send {sleep}}}</value>
</trigger>
<trigger name="thirsty" priority="2890" id="289">
<pattern>^You are hungry.$</pattern>
<value> #SWITCH (@posn)
("wake") {#send "get decan 'robe pockets many'"
#5 {#send "drink decan"}
#send "put decan 'robe pockets many'"}
("rest") {#send "get decan 'robe pockets many'"
#5 {#send "drink decan"}
#send "put decan 'robe pockets many'"}
("sleep") { #IF (@regen=1) {#wait 5000;#send rest;#send "get decan 'robe pockets many'"
#5 {#send "drink decan"}
#send "put decan 'robe pockets many'"} {#send rest;#send "get decan 'robe pockets many'"
#5 {#send "drink decan"}
#send "put decan 'robe pockets many'";#send {sleep}}}</value>
</trigger>
|
Only difference is in the drink trigger, and it's set up with the proper spacing in the trigger, so I have no clue why it gets forced to one line. |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 11, 2008 4:47 pm |
I'm afraid you've confused me. First you say they don't work. Then you say they do work, but not on new connections even though there are no differences. Then you say there is a difference in the drink trigger. Could you please explain exactly what is not working? If it is working on old sessions but not new ones, are you certain the @posn and @regen variables are being set properly?
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Sep 11, 2008 4:56 pm |
Both triggers work just fine on older "connections" that were last setup awhile back. However, when I made a new "connection", and put these in, they both fail, giving me illegal character errors. However, when I ctrl+k in the editor, it doesn't find any. Furthermore, the drink trigger that doesn't work in this new connection is EXACTLY the same as the one that does work in an older session. The Tick Regen trigger in the new "connection" also fails, and it's the same as the one in the old "connection" that works. However, the XML for the broken Tick Regen trigger and the working Tick Regen trigger are different, even though they were entered the same way, as you can see above. I'm extremely confused. It could possibly be the variables, I'll try that.
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Sep 11, 2008 5:09 pm |
Both variables are fine.
|
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 11, 2008 8:44 pm |
What do you mean by a "new connection"? Do you mean a new session file?
In this "new connection", are you recreating the trigger from scratch? Or are you loading a package which contains it? If you aren't loading a package, why not?
When does it give you this "illegal character" error? When you try to create the trigger? or when you try to use it? |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Sep 11, 2008 8:48 pm |
If you are trying to create the triggers fresh from the command line, your input is wrong. The first one should be:
| Code: |
#TRIGGER thirsty {^You are thirsty.$} {
#SWITCH (@posn)
("wake") {#5 {#send "drink decan"}}
("rest") {#5 {#send "drink decan"}}
("sleep") { #IF (@regen=1) {#wait 5000;#5 {#send "drink decan"}} {#send rest;#5 {#send "drink decan"};#send {sleep}}}
} {General Triggers}
|
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Sep 11, 2008 9:35 pm |
Ah, that could be it. But what about the second? As for the package thing, my packages are different for each character. Lots of things have common elements and I was going to make a General Package and to connect to each session, which would go in addition to each session's character package, but I never got around to it. Come to think of it though, I just switched the link on one package for a session, and it didn't ask if I wanted it to be added or to take the place of which would lead me to believe I could only have the session linked to that one package?
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Sep 11, 2008 9:59 pm |
I start scripting again and I keep having problems
Newest one should be simple, but I have a headache, maybe that's it.
| Code: |
#wait 400
#say Loading Box Alias...
#AL box {w;w;w;#10 {
#exec {get 5 'white stone' green
#wait 1000
put 5 'white stone' box}
} } {General Aliases}
|
I get the unmatched braces code. I figure it has something to do with the formatting because there's a brace for each prace, so I'm not sure what's wrong. |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Sep 11, 2008 10:52 pm |
The problem is with your #EXEC command. It actually only works when passing it a string value, and it doesn't handle multi-line syntax. You don't need the #EXEC at all. In fact, if you find yourself using #EXEC then you are usually doing something wrong left over from zMUD. The correct script is:
| Code: |
#wait 400
#say Loading Box Alias...
#AL box {
w;w;w
#10 {get 5 'white stone' green
#wait 1000
put 5 'white stone' box}
} {General Aliases} |
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Sep 11, 2008 11:00 pm |
Oh... someone here gave me the #exec command, thanks. I'm still very clueless I suppose 
|
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Sep 12, 2008 12:53 pm |
What do you mean by "switched the link"? Do you mean you edited the session and changed the name of the session package? If so, that is completely independent of the additional packages that get loaded.
To make a separate package, go to the Package Editor, click on File|New Package. After naming the package, you can move or copy classes, triggers, and aliases into it. The new package will automatically be added to the list of packages that load whenever you open this session. To get the same package into another session, close this session. Open the other session. Click on File|Open, and browse to find the new package. It will probably be under a folder named 'packages'. |
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 12, 2008 3:12 pm |
I have no clue why CMUD hates me, is there any reading on proper formatting for it?
| Code: |
#TRIGGER thirsty {^You are (?:thirsty|hungry).$}
{
#SWITCH (@posn)
("wake") {get @decan @decanc
#5 {#send "drink" @decan}
put @decan @decanc}
("rest") {get @decan @decanc
#5 {#send "drink" @decan}
put @decan @decanc}
("sleep") {rest
get @decan @decanc
#5 {#send "drink" @decan}
put @decan @decanc
sleep} } {General Triggers}
|
It wont fire, but doesn't warn me there's an error. I went in and looked and it said "illegal character in expression (", when I copied and pasted it into the editor though, I typed ctrl+k and got "no errors"
This is frustrating, I can't troubleshoot if I'm getting mixed answers from CMUD in the first place. |
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 12, 2008 5:20 pm |
I entered the trigger into the editor as opposed to the command line and it worked, this is very frustrating for me 
|
|
|
|
 |
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sat Sep 13, 2008 8:52 am |
| Code: |
#REGEX thirsty {^You are (?:thirsty|hungry)\.$} {
#SWITCH (@posn)
("wake") {
#send {get @decan @decanc}
#5 {#send {drink @decan}}
#send {put @decan @decanc}
}
("rest") {
#send {get @decan @decanc}
#5 {#send {drink @decan}}
#send {put @decan @decanc}
}
("sleep") {
#send rest
#send {get @decan @decanc}
#5 {#send {drink @decan}}
#send {put @decan @decanc}
#send sleep
}
} {General Triggers} |
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Sep 13, 2008 1:01 pm |
That gets this:
Error compiling script:
illegal character in expression: (
Even though there's no errors going in...
Edit: I'm just going to give up on the command-line version |
|
|
|
 |
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Sat Sep 13, 2008 3:53 pm |
That is because entering #REGEX... at the command line will result in #SWITCH (@posn)("wake") { line in the PE.
Reformat script in the editor. This works:
| Code: |
#SWITCH (@posn)
("wake")
{
#send {get @decan @decanc}
#5 {#send {drink @decan}}
#send {put @decan @decanc}
}
("rest")
{
#send {get @decan @decanc}
#5 {#send {drink @decan}}
#send {put @decan @decanc}
}
("sleep")
{
#send rest
#send {get @decan @decanc}
#5 {#send {drink @decan}}
#send {put @decan @decanc}
#send sleep
}
|
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Sep 13, 2008 4:57 pm |
Yeah, I already did that in the editor and it works. I was just hoping to get it to work straight from the command line. But it's fine, I don't need to use the command-line so I might as well begin to use the editor.
|
|
|
|
 |
|
|
|