multiline variables

Posted by Babochka on Wed 03 May 2006 04:39 AM — 6 posts, 22,796 views.

USA #0
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
Australia Forum Administrator #1
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.
USA #2
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.
USA #3
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
Australia Forum Administrator #4
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..
#5
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. :)