Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ multiline variables

multiline variables

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


Posted by Babochka   USA  (21 posts)  Bio
Date Wed 03 May 2006 04:39 AM (UTC)
Message
Hello I would like to do the following:

One of my 7 Achaea characters, Inima, is a magi. Before a magi can do anything, she must open the elemental channels. The commands to do this are channel air; channel earth; channel fire; channel water.

When you channel air, Achaea will send:
You forge a channel through to the elemental skein of the universe.
The power of air is harnessed to your will.

After a second it will then say:
You have recovered equilibrium.

What I wish to do is create an alias called chan4 which will use the open channel message + You have recovered equilibrium. as a trigger to channel the next element earth, then the message for earth:

You forge a channel through to the elemental skein of the universe.
The strength of earth is at your command.

plus the You have recovered equilibrium, will trigger the channel fire command and so on.

Can you tell me how to create a multi-lined variable for all this? Thanks in advance

Babochka the Russian butterfly
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 03 May 2006 05:56 AM (UTC)
Message
You mean a multi-line trigger I think?

Anyway, one approach would be to simply maintain a "state" so that you remember which element you are channelling, and when you eventually get "You have recovered equilibrium." you send the appropriate command.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Babochka   USA  (21 posts)  Bio
Date Reply #2 on Wed 03 May 2006 11:53 AM (UTC)
Message
Hello and Good afternoon

Yes a multi-line trigger.

I read the help file on it and I was experimenting with it. I wrote the following:

chan4 alias

<alias
match="chan4"
enabled="y"
echo_alias="y"
group="prep"
sequence="100"
>
<send>channel air</send>
</alias>

then i made the trigger
<trigger
enabled="y"
group="prep"
lines_to_match="2"
match="^The power of air is harnessed to your will\.\n * \n You have recovered equilibrium\.\z"
multi_line="y"
regexp="y"
sequence="100"
>
<send>channel earth</send>
</trigger>

I think my multi-line syntax is not right. Can you help me with this? I dont understand what you mean by a 'state'. I will continue to try to figure this out. Thanks.


Babochka the Russian butterfly.
Top

Posted by Babochka   USA  (21 posts)  Bio
Date Reply #3 on Wed 03 May 2006 12:46 PM (UTC)
Message
I have an idea. I've noticed the trigger lines for the 4 elements:

Air: The power of air is harnessed to your will.
Earth: The strength of earth is at your command.
Fire: Elemental fire burns at your request.
Water: Purest water soothes you into calm.

My idea is create a trigger which will check for the trigger line and put the element in a variable, like...

The power of * is harnessed to your will.

then have world.GetVariable ("ele")
if world.GetVariable = "air" then
world.SetVariable = "ele", "earth"
DoAfter 5, "channel" + world.GetVariable ("ele")

I'll try to figure out the syntax for this. I'll try it in Lua because someone said Lua is good

Babochka the Russian Butterfly
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 03 May 2006 08:07 PM (UTC)
Message
Quote:

lines_to_match="2"
match="^The power of air is harnessed to your will\.\n * \n You have recovered equilibrium\.\z"
multi_line="y"


For one thing you seem to be matching more than 2 lines here:


The power of air is harnessed to your will.
(multiple spaces?)
You have recovered equilibrium.


That is 3 lines, but I am not sure what the regexp for the middle line is supposed to be.

A "state" means to remember what happened earlier to guide what the script does next. For example if you got:


The power of air is harnessed to your will.


You could set a variable to remember that air is being channelled. Technically you could call this a state.

Your syntax for GetVariable and SetVariable is a bit out. I suggest you look at the help pages for them..

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Beale   (35 posts)  Bio
Date Reply #5 on Wed 03 May 2006 08:59 PM (UTC)
Message
I think most people scripting for Achaea use a sort of command stack, where one command is executed off the stack by the equilibrium trigger, and other triggers add commands to the stack.

So, for example,

<alias
match="channel elements"
enabled="y"
echo_alias="y"
group="prep"
sequence="100"
send_to="12"
>
<send>SetVariable("stack", "channel air|channel water|channel earth|channel fire")</send>
</alias>

<trigger
match="You have regained equilibrium."
enabled="y"
sequence="100"
send_to="12">
<send>Send(string.sub(GetVariable("stack"), "%.-|"))
SetVariable("stack", string.sub(GetVariable("stack"), "|%.*"))</send>
</trigger>


Please note - this looks okay to me, but I'm a little sleep-deprived. You may want to check it over before using it. :)
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.


16,951 views.

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

Go to topic:           Search the forum


[Go to top] top

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