|
Jorville Wanderer
Joined: 30 Apr 2006 Posts: 58 Location: Brookhaven, MS
|
Posted: Fri Sep 04, 2009 5:57 pm
triggers and #SAY |
ok i got this trigger that im trying to use to say something but i cant get the %1 thing to work. Its like this for example:
Soandso disables you.
So i make a trigger:
(*) disables you.
#SAY %1 has disabled you.
and it just gives a blank has disabled you.
Now i got this same (*) and %1 in a #substitute command and it works fine
i eventually just made the name be captured into a variable and had it display the variable, but i was just wondering why it was doing this? id rather it not be in a variable and work like the other one did
so what am i missing here? |
|
_________________ Jorville
Player on SWMUD |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Sep 04, 2009 7:17 pm |
This works fine for me.
So couple of things to check. First make sure you don't have any other triggers with that same pattern. Make sure that your #SUB isn't interfering with the trigger. (An easy way to do this is to set the trigger priority to 1.
You should also check to make sure the trigger compiles, and that the pattern matches (although it seems pretty straightforward). |
|
_________________ Asati di tempari! |
|
|
|
Jorville Wanderer
Joined: 30 Apr 2006 Posts: 58 Location: Brookhaven, MS
|
Posted: Fri Sep 04, 2009 8:56 pm |
Ok, so it seems to work how i put it above, but i forgot to mention i had it set in an alarm here is the actual code:
(*) takes a calculated swing at your head. Starbursts explode before your eyes and you find yourself unable to do anything but battle for your life!
#ALARM +1 {
#SAY {%ansi(high,red)***%ansi(high,black)%1 can disable again! Lookout!%ansi(high,red)***}
}
The alarm was originally set at 175 but i changed it to 1 for testing purposes. And when i removed the alarm part and just left it as a #say it worked. So im lost on it. |
|
_________________ Jorville
Player on SWMUD |
|
|
|
Jorville Wanderer
Joined: 30 Apr 2006 Posts: 58 Location: Brookhaven, MS
|
Posted: Sun Sep 06, 2009 7:22 pm |
Ok, so i've been looking at the script debugger window and i cant figure out the problem, i dont 100% understand what im looking at but i understand a good bit and i just cant figure it out. Here is the script debug code:
---
c SWMUD | [1] SWMUD Comline : start :
a SWMUD |Mob takes a calculated swing at your head. Starbursts explode before your eyes and you find yourself unable to do anything but battle for your life!
f SWMUD | Pattern: (*) takes a calculated swing at your head. Starbursts exp... : (%1="Mob")
c SWMUD | exec : Pattern "(*) takes a calculated swing at your head. Starb...
n SWMUD | Exec Trigger "(*) takes a calculated swing at your head. Starbursts explode be"
l SWMUD | Trigger "_Alarm13" compiled (Pattern) : +1
d SWMUD | [1] SWMUD Comline : stopped
f SWMUD | Alarm: +1
l SWMUD | Trigger "_Alarm13" compiled (Normal) : #SAY %ansi(high,red)***%ansi(high,black)%1 can disable a...
c SWMUD | exec : Alarm "_Alarm13" : #SAY %ansi(high,red)***%ansi(high,bla...
n SWMUD | Exec Trigger "_Alarm13"
a SWMUD |*** can disable again! Lookout!***
I test my triggers with the #echo command if that makes any diffrence. But it didnt work on mobs yesterday. So any thoughts? Thanks |
|
_________________ Jorville
Player on SWMUD |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Sep 07, 2009 12:58 am |
Well, I'm not entirely sure why you are putting it in an alarm in the first place, but...
The problem here is that the #alarm command is creating an alarm trigger containing "%1" instead of the value of %1. When the trigger fires, it doesn't know what %1 is, so it turns out blank. I don't believe there is currently any way to get the #alarm command to parse the values in its command argument at the time it creates the alarm. |
|
|
|
Jorville Wanderer
Joined: 30 Apr 2006 Posts: 58 Location: Brookhaven, MS
|
Posted: Mon Sep 07, 2009 2:43 am |
Im just trying to get the #SAY to include the name of the mob. I did it with a variable but i was just trying to avoid having to create a whole bunch of variables. I guess I will just have to go back to the variable method. Thanks for clearing it up.
|
|
_________________ Jorville
Player on SWMUD |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Sep 07, 2009 4:02 am |
#TRIGGERs cannot access the arguments of other #TRIGGERs. #ALARM has no arguments that can be assigned to variables (with regards to the %1...%99) stuff, and #ALARM is a type of #TRIGGER.
If you want to wait a specific amount of time after a line of text appears on-screen, you need to use a wait-state #CONDITION:
#trigger {(*) just hit you! Ouch!} {the code this trigger is supposed to execute}
#condition {} {#say %t1 is too tough for you! Run away!} {wait|param=1000}
You may even be able to use wait in that #trigger, but I don't recall getting that to work. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Sep 07, 2009 4:12 am |
Try this one.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="10" copy="yes">
<pattern>(*) takes a calculated swing at your head. Starbursts explode before your eyes and you find yourself unable to do anything but battle for your life!</pattern>
<value>$enemy=%1
#ALARM +1 {
#SAY {%ansi(high,red)***%ansi(high,black)$enemy can disable again! Lookout!%ansi(high,red)***}
} </value>
</trigger>
</cmud> |
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Jorville Wanderer
Joined: 30 Apr 2006 Posts: 58 Location: Brookhaven, MS
|
Posted: Mon Sep 07, 2009 6:15 pm |
yea this is more what im looking for, i didnt see any variable that it created, thanks, so what is the help file on this $ variable usage, i cant seem to find it?
Arminas wrote: |
Try this one.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="10" copy="yes">
<pattern>(*) takes a calculated swing at your head. Starbursts explode before your eyes and you find yourself unable to do anything but battle for your life!</pattern>
<value>$enemy=%1
#ALARM +1 {
#SAY {%ansi(high,red)***%ansi(high,black)$enemy can disable again! Lookout!%ansi(high,red)***}
} </value>
</trigger>
</cmud> |
|
|
|
_________________ Jorville
Player on SWMUD |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
|
|
|
|
|