Page 1 of 1

Random trigger with OnExit

Posted: Wed Oct 27, 2010 3:53 pm
by Kinglouie
I have been working with this and can't get it working. Currently I have the code locked out so I can work with the second one to get the coding right but I'm missing something somewhere. What I am trying to do is set it up so when somebody leaves, my bot will display a message then perform a self trigger and post a picture on specific keywords.

//<OnLeave type="script">
//<out type="push" extdata="$Randum_Result$">%RANDOMNUM[9]%</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="0">%NAME% just went poof</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="0" type=self>!poof</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="1">Waves bye bye to %NAME%!</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="2">Fine %NAME% Get the hell out. We didn&apos;t want you here anyway, lol. J/K. Hurry back.</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="3">Bye bye %NAME%, come back soon please!</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="4">heh Now that %NAME% has gone we can drink all their beer!</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="4" type=self>!beer</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="5">Fine let %NAME% leave, we know they&apos;ll be back cuz we&apos;re just that damn good!!! </out>
//<out condition="==" lvalue="$Random_Result$" rvalue="6">Hey come back here!! I didn&apos;t give u permission to leave!</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="7">Awwwwwww ... it&apos;s too quiet since %NAME% left ... someone Say Something!!!</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="8">Don&apos;t worry we&apos;ll see %NAME% again soon ... they just can&apos;t get enough.</out>
//<out condition="==" lvalue="$Random_Result$" rvalue="9">Nooooooooo %NAME%!!!!!!!!! Come Back, Come Back!!!!!!!!!!!!!!</out>
//</OnLeave>

I have this code in my MXC for testing so I can test without someone haveing to leave all the time.

<command type="script">
<in>beer</in>
<out type="push" extdata="$Randum_Result$">%RANDOMNUM[8]%</out>
<out condition="==" lvalue="%Random_Result%" rvalue="0">Waves bye bye to %NAME%!</out>
<out condition="==" lvalue="%Random_Result%" rvalue="1">Fine %NAME% Get the hell out. We didn&apos;t want you here anyway, lol. J/K. Hurry back.</out>
<out condition="==" lvalue="%Random_Result%" rvalue="2">Bye bye %NAME%, come back soon please!</out>
<out condition="==" lvalue="%Random_Result%" rvalue="3">heh Now that %NAME% has gone we can drink all their beer!</out>
<out condition="==" lvalue="%Random_Result%" rvalue="3" type=self>!beer</out>
<out condition="==" lvalue="%Random_Result%" rvalue="4">Fine let %NAME% leave, we know they&apos;ll be back cuz we&apos;re just that damn good!!! </out>
<out condition="==" lvalue="%Random_Result%" rvalue="5">Hey come back here!! I didn&apos;t give u permission to leave!</out>
<out condition="==" lvalue="%Random_Result%" rvalue="6">Awwwwwww ... it&apos;s too quiet since %NAME% left ... someone Say Something!!!</out>
<out condition="==" lvalue="%Random_Result%" rvalue="7">Don&apos;t worry we&apos;ll see %NAME% again soon ... they just can&apos;t get enough.</out>
<out condition="==" lvalue="%Random_Result%" rvalue="8">Nooooooooo %NAME%!!!!!!!!! Come Back, Come Back!!!!!!!!!!!!!!</out>
</command>

Re: Random trigger with OnExit

Posted: Wed Oct 27, 2010 3:58 pm
by Pri
You have four issues here. In the extdata=" " part you are using $ - You don't need to do that, extdata is always for a variable so the script doesn't need to be told you are placing a variable by signifying it by surrounding the variable name with $ signs.

And in the conditions you are using %Random_Number% - Variables that are surrounded by % % are not user modifiable variables these are constant variables. That is why %NAME% and %RAWNAME% have % % while all user variables have $ $ the only exception to this is %USERVAR[]% where you can place a variable inside such as %USERVAR[Random_Number]%

The third issue is that on the first variable you have called it Randum_Result but in the subsequent variables you have named it Random_Result they need to be named the same.

The final issue is that this line: <out condition="==" lvalue="$Random_Result$" rvalue="3" type=self>!beer</out> Needs to be <out type="self" condition="==" lvalue="$Random_Result$" rvalue="3">!beer</out>

So to fix your code:

<command type="script">
<in>beer</in>
<out type="push" extdata="Random_Result">%RANDOMNUM[8]%</out>
<out condition="==" lvalue="$Random_Result$" rvalue="0">Waves bye bye to %NAME%!</out>
<out condition="==" lvalue="$Random_Result$" rvalue="1">Fine %NAME% Get the hell out. We didn&apos;t want you here anyway, lol. J/K. Hurry back.</out>
<out condition="==" lvalue="$Random_Result$" rvalue="2">Bye bye %NAME%, come back soon please!</out>
<out condition="==" lvalue="$Random_Result$" rvalue="3">heh Now that %NAME% has gone we can drink all their beer!</out>
<out type="self" condition="==" lvalue="$Random_Result$" rvalue="3">!beer</out>
<out condition="==" lvalue="$Random_Result$" rvalue="4">Fine let %NAME% leave, we know they&apos;ll be back cuz we&apos;re just that damn good!!! </out>
<out condition="==" lvalue="$Random_Result$" rvalue="5">Hey come back here!! I didn&apos;t give u permission to leave!</out>
<out condition="==" lvalue="$Random_Result$" rvalue="6">Awwwwwww ... it&apos;s too quiet since %NAME% left ... someone Say Something!!!</out>
<out condition="==" lvalue="$Random_Result$" rvalue="7">Don&apos;t worry we&apos;ll see %NAME% again soon ... they just can&apos;t get enough.</out>
<out condition="==" lvalue="$Random_Result$" rvalue="8">Nooooooooo %NAME%!!!!!!!!! Come Back, Come Back!!!!!!!!!!!!!!</out>
</command>

Hope this helped!