conditionals

Farvardin
10 Aug 2003, 10:56
I have a problem with conditionals
I made this command :


command <ask #@Livolas# for help ; tell #@Livolas# to cut #@thorns#>
{ if not flag <barriere1_removed> then {
msg <You friend was so amazed by the beauty of the lady that he couldn't make a single move. Now he takes his axe and quickly breaks the first layer of thorns.>
'doaction <thorns ; cut1>
flag on <barriere1_removed> }
else
msg <He answers you he can't really use his axe here, the thorns are thicker and bigger, and he may also hurt the girl inside.>
}

For the 1st time the player ask this, I want a special reply, and a flag is removed, so the second time the reply is different. But in reality I get :

> ask livolas for help
You friend was so amazed by the beauty of the lady that he couldn't make a single move. Now he takes his axe and quickly breaks the first layer of thorns.
He answers you he can't really use his axe here, the thorns are thicker and bigger, and he may also hurt the girl inside.

It seems it tests the flag several times

The same goes to

action <talkto> {
if flag <barriere1_removed> and flag <barriere2_removed> then {
msg <You talk to her but she seems to be more interested in Livolas. >
flag on <story2> }
if not flag <barriere1_removed> then msg <You can't reach her.> else {
msg <She's pleased to see some kind people are helping her. She tells you she's called Goteline, and she has been imprisoned here for several hours, and she was going to die without your help.>
flag on <story1>
property <Goteline; alias = Goteline> }
if not flag <story1> and not flag <barriere2_removed> then msg <She probably expects you free her completely now.>

I get unexpected replies :

> talk to lady
You can't reach her.
She probably expects you free her completely now.



What can I do ? Is it normal ?

Alex
10 Aug 2003, 11:53
Your first example works properly for me - I get:


> ask livolas for help
You friend was so amazed by the beauty of the lady that he couldn't make a single move. Now he takes his axe and quickly breaks the first layer of thorns.

> ask livolas for help
He answers you he can't really use his axe here, the thorns are thicker and bigger, and he may also hurt the girl inside.



Your second example gives me the same as you, but this is what I expect. The flag barriere_removed is not set, so the text "You can't reach her" is displayed. Then the flag story1 is not set and the flag barriere2_removed is not set either, so the text "She probably expects you free her completely now" is displayed.

In both cases the code executes only once.

It may be that something else in your ASL code is causing you problems, so if you can't work it out, send it to me and I'll take a look.

Farvardin
10 Aug 2003, 15:58
Thank you for your help (you were right for the second part). Even with it I search for long and noticed also several other pb (both in the 1st and 2nd part). I needed to rewrite the code and now it works as expected for the two.