|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Apr 04, 2009 7:03 pm
Help Me Debug a Trigger? |
This is an odd case, and no amount of looking at the trigger has helped me get any answers, so I bring it to you to maybe see something I missed.
Here's the trigger:
Code: |
#IF (@inactive)
{
#switch (@posn="wake") {
#send {"c 'sanctuary'"}
}
("rest")
{
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"rest" @bed}
}
("sit")
{
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"sit" @bed}
}
("sleep")
{
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"sleep" @bed}
}
}
|
I double checked, there's only one bed variable, and only one posn variable. Both of them match case, only thing of note is that they're in a separate package than the trigger, but that shouldn't matter.
Here's the problem (anything in () is a command sent to the MUD, anything italicized was sent by CMUD via trigger or some such, bold means it's a #say):
Quote: |
Beginning Test...
(quaff greenish)
You quaff a greenish, chunky potion.
You are surrounded by a white aura.
(affect)
> 11:00pm | 1825/1825hp | 1089/1089mn | 406/406mv |
(sleep couch)
You are affected by the following spells:
Spell: sanctuary : modifies none by 0 for 3 cycles, (1 1/2 hours)
Spell: detect invis : modifies none by 0 for 24 cycles, (12 hours)
Spell: detect hidden : modifies none by 0 for 24 cycles, (12 hours)
Permanency Cooldown : 18 hours and 10 minutes remaining.
> 11:00pm | 1825/1825hp | 1089/1089mn | 406/406mv |
You go to sleep on a plush couch made of royal purple velvet.
> 11:00pm | 1825/1825hp | 1089/1089mn | 406/406mv |
TICK IN 5 SECONDS.
> 11:30pm | 1825/1825hp | 1089/1089mn | 406/406mv |
--------------
sleep
couch
3 | Will recast when sanc is one, should go back to posn
-------------
TICK IN 5 SECONDS.
> 12:00am | 1825/1825hp | 1089/1089mn | 406/406mv |
--------------
sleep
couch
2 | Will recast when sanc is one, should go back to posn
-------------
TICK IN 5 SECONDS.
> 12:30am | 1825/1825hp | 1089/1089mn | 406/406mv |
You wake and stand up.
Conclave Common Room
This is the common room of the Conclave of Magic, where members of all
robes can meet. There are couches and cushions lying all around the room.
There is an entrance to each of the three towers. The White Tower lies to
the north, the Black Tower to the southwest, the Red Tower is to the
southeast. East of here is the Apothecary of the Conclave while to the west
lie the Conclave Stables, and to the south is the Meeting Room of the
Conclave.
[Exits: north east south west up down southwest southeast ]
A huge couch of plush, royal purple velvet and silver embroidery sits here.
A small white fountain gushes forth here.
Incredibly, a rough sphere of objects are floating together here, slowly spinning.
(White Aura) Qolton is sleeping on a plush couch made of royal purple velvet.
(White Aura) Jur'ik Blastforge. is here.
> 12:30am | 1825/1825hp | 1089/1089mn | 406/406mv |
You are surrounded by a white aura.
(affect)
> 12:30am | 1825/1825hp | 1014/1089mn | 406/406mv |
You sit on a plush couch made of royal purple velvet and rest.
|
No clue what's going on here. It won't show the command for:
stand
c 'sanctuary'
rest couch
which is what it's doing, and it has shown that before but for some reason didn't show this time. But, according to the trigger, it should go to sleep, not rest. No clue what's wrong. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Sat Apr 04, 2009 8:34 pm |
@inactive isn't %null or 0 is it?
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Sun Apr 05, 2009 12:36 am |
your 2'nd, 3'rd and 4'th condition statements for your #switch arn't actually conditions. I believe your code should read
Code: |
#IF (@inactive){
#switch (@posn="wake") {
#send {"c 'sanctuary'"}
}
(@posn="rest") {
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"rest" @bed}
}
(@posn="sit") {
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"sit" @bed}
}
(@posn="sleep") {
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"sleep" @bed}
}
} |
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun Apr 05, 2009 3:06 am |
wrym wrote: |
your 2'nd, 3'rd and 4'th condition statements for your #switch arn't actually conditions. I believe your code should read
Code: |
#IF (@inactive){
#switch (@posn="wake") {
#send {"c 'sanctuary'"}
}
(@posn="rest") {
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"rest" @bed}
}
(@posn="sit") {
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"sit" @bed}
}
(@posn="sleep") {
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"sleep" @bed}
}
} |
|
Doesn't need to be like that, wyrm. It can work just the way he has it.
Charneus |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Sun Apr 05, 2009 4:13 am |
i'm not talking about his formatting, thats personal preference what i am talking about is what he has for his conditions...
Code: |
<alias name="asdf" id="320">
<value>#switch (%1 ="one") {#print one}
("two") {#print two}
("three") {#print three}
(1) {#print not one two or three}</value>
</alias> |
asdf one, prints one
asdf three, prints two
"two" returns true, it's not null
chamenas has
Code: |
("rest")
{
#send {"stand"}
#send {"c 'sanctuary'"}
#send {"rest" @bed}
} |
("rest") returns true, so the other conditions in his #switch are never checked, not that "rest" is actually checked |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Sun Apr 05, 2009 6:29 am |
this works as well
#SWITCH @var ("this") {do this} ("that") {do that} {do nothing} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 05, 2009 1:01 pm |
Yeah, but that's not what he has. It either needs to be:
Code: |
#switch (@var)
("val") {cmd}
("val2") {cmd2} |
or
Code: |
#switch (@var="val") {cmd}
(@var="val2") {cmd2} |
not some combination of the two. |
|
|
|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Sun Apr 05, 2009 1:13 pm |
Heh, #SWITCH was such a nice addition to CMUD. Though it seems like it turned out to be a little bit of a fickle child when it comes to being syntactically correct.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 05, 2009 5:09 pm |
Not really, you just have to do it right, but that's the same for anything :P
There are two syntaxes, and you can use either of them. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 07, 2009 4:04 pm |
I fixed it with (@posn="target"), thanks.
|
|
|
|
|
|