Hey again everyone! thanks for the help so far, it’s really great! Unfortunately i have already run into a new problem, that i don’t seem to be able to fix. I am really trying to overcome these issues on my own, but Inform 7 is just such a strange (but great) coding language that i find it hard to master without the guidance of experienced users
I’m having some code that executes perfectly but doesn’t seem to work out the way it’s intended to. I have tried all sorts of combinations, and feel like i have come very far, but this on is just very weird to me.
What im trying to do is to make an attack system, where the monster firstly will spot the player, and then after a turn attack the player.
[code]
A person can be seen or unseen. A person is usually unseen.
Every turn:
if the player is unseen begin;
if a monster can see the player begin;
say “You are spotted!”;
the player is seen in one turn from now;
end if;
end if.
At the time when the player is seen:
now the player is seen;
Every turn:
repeat with madman running through people begin;
if madman is hostile begin;
if the player is seen begin;
try madman attacking the player;
end if;
end if;
if madman is dead, now madman is docile;
end repeat.[/code]
That is the code and it compiles without error. The thing is that for some reason this combination of this piece of code never executes:
At the time when the player is seen:
now the player is seen;
Which means that the monster never commences to attack, and just reads “You are spotted!” every turn repeatedly.
but if i remove the if statement in the “madman” sequence, then that piece of code executes just fine (only saying “you are spotted!” once).
Every turn:
repeat with madman running through people begin;
if madman is hostile begin;
try madman attacking the player;
end if;
if madman is dead, now madman is docile;
end repeat.
which makes it say “You are spotted!” only once, but makes the monster attack right away (the action we are trying to delay with only one turn).