[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Please help, been trying to figure this out for a few hours now :(

Please help, been trying to figure this out for a few hours now :(

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by AaronM86   (42 posts)  [Biography] bio
Date Mon 29 Mar 2010 12:28 AM (UTC)
Message
How can I get the following trigger to work??


<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Basic - Support"
match="^(.*?) says \'(.*?) me\'$"
regexp="y"
send_to="12"
sequence="100"
>
<send>if "%1" == "self" then
world.send ("say Not going to happen")
elseif "%1" == "anythingotherthanthewordself" then
world.send ("cast %2 %1")
end</send>
</trigger>
</triggers>
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #1 on Mon 29 Mar 2010 12:44 AM (UTC)

Amended on Mon 29 Mar 2010 12:45 AM (UTC) by Twisol

Message
First: What's not working? It's hard to help you when we don't know what the symptoms are.

Second: it's world.Send, not world.send. Case matters.

Third: And... you can just use else instead of elseif "%1" == "something else" then.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #2 on Mon 29 Mar 2010 01:03 AM (UTC)
Message
Sorry for the quick post without explanation. I'm playing a MUD. I'm trying to make it so that if "Self" is seen as the sender of a say message, it will send say Not gonna happen.
But if anything other than the word "Self" is seen then it will cast on the sender of the say message if their message looks like this. Timmy says 'heal me' / I then send: cast heal timmy. I also want to have heal represented by %2 so I can send what spell they wish to be cast upon them. The reason I am trying to out Self is so that I cannot be tricked into casting damage spells onto myself.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #3 on Mon 29 Mar 2010 01:18 AM (UTC)
Message
AaronM86 said:
Sorry for the quick post without explanation. I'm playing a MUD. I'm trying to make it so that if "Self" is seen as the sender of a say message, it will send say Not gonna happen. The reason I am trying to out Self is so that I cannot be tricked into casting damage spells onto myself.


Oh, yes, I understand that. My point is that you can do it much more simply.

Here's a version of the <send> script with my suggested changes (which you didn't say whether they worked or not):

if "%1" == "self" then
  world.Send("say Not going to happen")
else
  world.Send("cast %2 %1")
end

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #4 on Mon 29 Mar 2010 03:02 AM (UTC)
Message
Hrm, thank you for your help first off... I entered that in my trigger but for some reason now I can't even get the trigger to fire when it sees the appropriate message.
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #5 on Mon 29 Mar 2010 03:22 AM (UTC)
Message
Would using Jscript as my drop-down bar menu selection, under the Scripts sub-menu, for Scripting main-menu, pose any sort of problem as to why it's not firing at all now? I had a script file with jscript from a friend that I was using, does setting the trigger send to: Script conflict because it's written differently?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Mon 29 Mar 2010 04:28 AM (UTC)
Message
I would use Lua unless you have a big reason not to.

As for the trigger, can you post the line (from the MUD) that you think it should match on, but doesn't?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #7 on Mon 29 Mar 2010 04:43 AM (UTC)

Amended on Mon 29 Mar 2010 04:45 AM (UTC) by Twisol

Message
AaronM86 said:

Would using Jscript as my drop-down bar menu selection, under the Scripts sub-menu, for Scripting main-menu, pose any sort of problem as to why it's not firing at all now? I had a script file with jscript from a friend that I was using, does setting the trigger send to: Script conflict because it's written differently?


Yes, that code uses Lua, not JScript. You can't use two different scripting languages at once. The exception is when you have scripts in a plugin, because a plugin can run separately from the world and other plugins.

It might not keep the trigger from firing, but it would cause problems, certainly.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #8 on Mon 29 Mar 2010 04:59 AM (UTC)
Message
Okay this has gotten me further. First changed scripting to Lua, and trigger still wasn't firing. Disabled my chat_redirector plugin that was pulling my says to log in another world window. And now it is firing the new say trigger for this setup we're discussing; except it seems to be ignoring the ifcheck on the Self and still casting on me.
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #9 on Mon 29 Mar 2010 05:11 AM (UTC)
Message
The line I'm trying to fire off of is Trigger: * says '* me'

I also tried converting to regular expression, but I have the same problem occur, where it's now ignoring the ifcheck for Self and still casting on me.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #10 on Mon 29 Mar 2010 06:00 AM (UTC)
Message
He meant the line on the MUD that you're trying to trigger on, not the pattern line you're using to do it. An example of real output from the MUD you're trying to respond to.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #11 on Mon 29 Mar 2010 06:08 AM (UTC)
Message
Self the male Gryphon Cub says 'distort me'
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #12 on Mon 29 Mar 2010 06:15 AM (UTC)

Amended on Mon 29 Mar 2010 06:18 AM (UTC) by Twisol

Message
AaronM86 said:

Self the male Gryphon Cub says 'distort me'


Okay, I think this is your issue. This is your pattern:

^(.*?) says \'(.*?) me\'$

It will catch everything up to the "says" for capture 1. So %1 is "Self the male Grphon Cub". What I expect you really want is this:

^([^ ]+).*says '(.*?) me'$

That little voodoo there means "one or more of anything but a space". It'll capture up until the first space, which means it should capture "Self". I also have .* after it so that you can have stuff like suffixes and titles after the name - which you do have here - without actually capturing it.

The final issue I'm seeing is that "Self" is not the same as "self". Case matters! You should either check the "ignore case" checkbox for this trigger, or use this instead to compare:

if string.lower("%1") == "self" then


That'll return a lowercased version of the capture, which would be "self" in this case.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #13 on Mon 29 Mar 2010 06:23 AM (UTC)
Message
Excellent, the ignore case checkmark wouldn't work, still casted on me in that circumstance. But your string.lower check fixed everything. Thank you so much for your patience with me tonight; you have helped me to learn alot. I'm just a beginner with alot of these kinds of things. I've been learning from my friends jscript file that he put together for me by just copying his functions and what not and trying to piece together my own inventions from that lol. If I can get Lua to work through my triggers like this more efficiently then I'll surely do more research into that language. Again, I truly appreciate your help.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #14 on Mon 29 Mar 2010 06:34 AM (UTC)
Message
Not a problem! I'm glad I could help. :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


43,190 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]