Scripting / Trigger help

Posted by Redhead22 on Sun 17 Oct 2004 06:10 AM — 5 posts, 16,319 views.

#0
I am a complete newbie when it comes to this sooo help would be appreciated, considering my caveman like advancement of scripting.
Trying to create a script to do the following...

When my health reaches 220 I want to go west, north, west, west, north.
simple right? Weeeellll not so much for me. I also want to go east, south, east, east, south when my health is below 29. The problem I have is that because the prompt repeats itself after each command it fires the same path a couple hundred times in a row (talk about spam!)I tried to disable the trigger after it fired and enable the other at the same time but it doesn't seem to work.
See if you can help please.
prompt: <Health [220] Armor [10] Gold [3,000]>
-----------------------------------------------
labeled "training1" trigger
-----------------------------------------------
Trigger: <Health [*] Armor [*] Gold [*]>
Send:
if %1 > 219 then
send "w"
send "n"
send "w"
send "w"
send "n"
end if
world.enabletrigger "training1", FALSE ' disable trigger
world.enabletrigger "healing1", TRUE ' enable trigger

-----------------------------------------------
labeled "healing1" trigger
-----------------------------------------------
Trigger: <Health [*] Armor [*] Gold [*]>
Send:
if %1 < 29 then
send "s"
send "e"
send "e"
send "s"
send "e"
end if
world.enabletrigger "training1",TRUE ' enable trigger
world.enabletrigger "healing1", FALSE ' disable trigger
--------------------------------------------------

Well there it is, not too sophisticated but what on Earth will make the Trigger fire once then disable that one and enable the other. I wouldn't be surprised if i did everything wrong.
USA #1
You need to put the disable/enable inside the if statements.
Since, you only want to switch to one mode if youre in the other. And otherwise youll match on ANY prompt, and then disable the prompt trigger.

So,
If < 29 then
disable stuff (since the movement will mean more prompts)
Move
Enable Stuff
end if

and the same goes for the other one.


And you could in theory make them the same trigger. With two if statements.

And next time, copy/paste the triggers. Since, (this one doesnt look it, but in theory) the problem could be that you dont have the right send to, or whatever. And its less work anyway.
#2
Ok, I took the two triggers, made them one named "training1" and put the disables/enables inside the if statement, but I still get the same problem. Are my disables written wrong or what?

<triggers>
<trigger
enabled="y"
match="&lt;Health [*] Armor [*] Gold [3,000]&gt;"
name="training1"
send_to="12"
sequence="100"
>
<send>if %1 &lt; 29 then
world.enabletrigger &quot;training1&quot;, FALSE ' disable trigger
send &quot;s&quot;
send &quot;e&quot;
send &quot;e&quot;
send &quot;s&quot;
send &quot;e&quot;
world.enabletrigger &quot;training1&quot;, TRUE ' enable trigger
end if

if %1 &gt; 219 then
world.enabletrigger &quot;training1&quot;, FALSE ' disable trigger
send &quot;w&quot;
send &quot;n&quot;
send &quot;w&quot;
send &quot;w&quot;
send &quot;n&quot;
world.enabletrigger &quot;training1&quot;, TRUE ' enable trigger
end if


</send>
</trigger>
</triggers>
USA #3
Do you get anything at all? Do you get spammed?
What works? What doesnt?

If you never get into the if loops (or you do at a wrong time) try using CInt(%1) instead of just %1.
VBscript has a problem with variables being ANYTHING, so it might be trying to compare "24" with 19 (as in, the string 24).

But, whats going wrong? From a brief glance, that all looks syntactically correct.
#4
Ok I did things a little differently this time...
I made four triggers
-----------------------------------------------
<triggers>
<trigger
match="&lt;Health [*] Armor [*] Gold [3,000]&gt;"
name="healing1"
send_to="12"
sequence="100"
>
<send>if %1 &lt; 29 then
world.enabletrigger &quot;healing1&quot;, FALSE ' disable trigger
send &quot;s&quot;
send &quot;e&quot;
send &quot;e&quot;
send &quot;s&quot;
send &quot;e&quot;
end if


</send>
</trigger>
</triggers>

--------------------------------------------
then one just like it only going opposite dirrection ("training1")
then i added 2 new triggers to activate them at different times. So "healing1" & "training1" disable themselves but dont get enabled until I reach the destined room or message.
--------------------------------------------
<triggers>
<trigger
enabled="y"
match="A mob name in the destined room."
send_to="12"
sequence="100"
>
<send>world.enabletrigger &quot;training1&quot;, TRUE ' enable trigger</send>
</trigger>
</triggers>
----------------------------------------------
<triggers>
<trigger
enabled="y"
match="A message recieved from entering the room."
send_to="12"
sequence="100"
>
<send>world.enabletrigger &quot;healing1&quot;, TRUE ' enable trigger</send>
</trigger>
</triggers>
-----------------------------------------------
It's a little bit bulky but seems to work fine, thanks for the help! :)