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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  a trigger, and an alias

a trigger, and an alias

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


Pages: 1 2  

Posted by Ignis   (26 posts)  [Biography] bio
Date Sun 24 Apr 2005 08:12 AM (UTC)
Message
i seem to be having troubles following the guide, one trigger i'm trying to get to work is "|||||||| >" (the fatigue bar in a game i play) to display as "8 >" but for some reason "* |{8} >* won't work, also an alias i'm trying to get to work "@ *", the body appearing as:
get %1
drop %1
remove quartz
take blade from bag
light %1
it works with what i type in, but is there a way to save key strokes as there are only 2 types of kindling in game, shredded bark, and dried grass, i was wondering if there was a way to make it so that typing "@ bark" would automatically know to put in shredded bark, and "@ grass" know to put in dried grass into the wildcard, if calling from a variable to use this trigger would work, i've already figured out how to make a trigger that does that, it's title is kindling, and it basically switches between the two depending on what type of area i'm in, i'm not trying to cheat, just save keystrokes
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Sun 24 Apr 2005 09:18 AM (UTC)
Message
If you're going to use quantifiers ({8}) then you'll need to use a regexp, which means you'll need to escape the | (\|) and the * (actually, since * is probably a wildcard, you'll replace it with (.*).

And the second example should work, could you post the exact trigger you're using?

And, to be perfeclty honest, I don't understand what you're asking for in the last bit. Do you want the same alias to do it (with the get, drop, etc)? or... expand where?
It's definately doable, once I figure out what you're looking to do.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #2 on Sun 24 Apr 2005 09:28 AM (UTC)
Message
basically i want one trigger that can get shredded bark, or get dried grass for use as kindling by entering the appropriate into the %1 in the above alias example, then of course get the other items, and light the kindling, i should be able to make the output trigger work though for the number instead of |||| >, so thanks for that, and thanks for helping with this as well, if i need to elaborate further, i'll be glad to do so as i tend to not be the best at explaining things
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Sun 24 Apr 2005 09:35 AM (UTC)
Message
Depending on the scripting language you're using, it'll be different, but basically:

Instead of using %1 for most, you'll use a temporary variable, which you can check for grass or bark and change the variable accordingly. Something like this (of course, this isn't in any particular language):

temp = "%1"
if temp == "grass"
temp = "dried grass"
if temp == "bark"
temp = "shredded bark"
send "get " & temp
send "drop " & temp
send "remove quartz"
send "take blade from bag"
send "light " & temp

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #4 on Sun 24 Apr 2005 09:52 AM (UTC)
Message
ok, i think i know how to proceed from here, though admittedly, i've never called for a script from within an alias before
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Sun 24 Apr 2005 09:54 AM (UTC)
Message
You don't need to. To save the effort of making a script file, and calling a routine (and then moving that script whenever you move the alias, etc), just put the script into the trigger, and change the "send" to "send to script".

This way you can use %1, otherwise you'll have to deal with an array.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #6 on Sun 24 Apr 2005 10:05 AM (UTC)
Message
and i must be an idiot cause i've got it partially working except now it says "Send-to-script cannot execute because scripting is not enabled." even though i've checked the enable box
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #7 on Sun 24 Apr 2005 10:12 AM (UTC)
Message
Did you enable scripting? (Game > Config > Scripting)? And of course, choose a language.
If that doesn't work, try saving the world after enabling scripting (not that it should make a difference).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #8 on Sun 24 Apr 2005 10:20 AM (UTC)
Message
it's enabled, according to the little check box, but it's still not working, is there perhaps something in the trigger i need to look for?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #9 on Sun 24 Apr 2005 10:27 AM (UTC)

Amended on Sun 24 Apr 2005 10:31 AM (UTC) by Flannel

Message
Why don't you go ahead and post the trigger.

What script language are you set for? And do you have a script file selected? (Not that either would cause failure, just trying to track down the problem).
What version of MC are you using?

Try disabling, and reenabling the script (close the dialog after each). Maybe that will solve it.

Do you get any errors when reloading the script? It's the button next to the autosay and reset timers.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #10 on Sun 24 Apr 2005 10:32 AM (UTC)
Message
<trigger>^(.*?) forest (.*?)$


<send>temp = "%1"
if temp = "grass", then temp = "dried grass"
if temp = "bark", then temp = "shredded bark"
World.send "get " & temp
World.send "drop " & temp
World.send "remove quartz"
World.send "take blade from bag"
World.send "light " & temp
<send> to script
<script> temp


it might be those commas, it's been a while since i coded
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #11 on Sun 24 Apr 2005 10:36 AM (UTC)
Message
one other thing, this is the desc i'm trying to get whether i need bark or grass from

Heavily wooded forest

Obvious exits: nothing
It is nearly pitch black here.
------------------------------------------------------------------
Dense foliage crowds this area, nearly black at this time of night. Above,
dappled wedges of the night sky are visible through the thick branches;
column-like tree trunks stand starkly against this shadowy backdrop. Fallen
branches and leaves, some tangled in the ever-present undergrowth, are visible
in the few shafts of pale light.
This area is vast.
------------------------------------------------------------------
A wood cabin is to the southwest.
==================================================================



the name of the room, in this case heavily wooded forest is always bold, and that's what i've been trying to get the alias for lighting kindling to respond to
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #12 on Sun 24 Apr 2005 10:37 AM (UTC)

Amended on Sun 24 Apr 2005 10:38 AM (UTC) by Flannel

Message
You can 'copy' the trigger and paste it here (please do) copy from the main trigger dialog (copy button).

But, a bad script won't cause problems (until it's run).

Do remove the script function though, since you don't need it.

Did you get any errors when reloading the script? I can't remember if an error will make the script engine stop working completely, but it does seem like it might.

And what language are you writing in?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ignis   (26 posts)  [Biography] bio
Date Reply #13 on Sun 24 Apr 2005 10:42 AM (UTC)
Message
<triggers>
<trigger
custom_colour="15"
enabled="y"
lines_to_match="16"
match="^(.*?) forest (.*?)$"
multi_line="y"
omit_from_output="y"
regexp="y"
script="temp"
send_to="12"
sequence="100"
variable="kindling"
>
<send>shredded bark</send>
</trigger>
</triggers>
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #14 on Sun 24 Apr 2005 10:47 AM (UTC)
Message
Wait, what? Where did that come from? You could set a variable for the 'current item', but we're still working on the other problem (or did that fix itself?) since, scripting won't do you any good if you can't get scripting to work.

And that last trigger would call the 'temp' routine, and then send "shredded bark" to the script engine, which would generate a syntax error (most likely). You do one or the other (send to script or a script function) well, under normal circumstances.

Why are you matching 16 lines?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[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.


53,594 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]