Arrghh!!

OurJud
31 Oct 2016, 14:33

What the hell am I doing wrong???

After the player clicks Hunt for food in the forest room, I add a flag to him called gotfood

Then back in the shack, I check for that flag and if it's there, I make an exit called havefood (which creates the link Cook food) visible. So why the hell won't it show up??

Forest:

MakeExitInvisible (havebow)
msg ("It was a long hunt, but a scrawny rabbit was eventually caught.<br/>")
SetObjectFlagOn (player, "gotfood")

Shack:

if (GetBoolean(player, "gotfood")) {
  MakeExitVisible (havefood)
  msg ("Not much, but hot and delicious.")
}

Anonynn
01 Nov 2016, 18:00

There's probably a more simple way of doing it. I'm not sure if I'll explain it correctly or not but what I would do is ....

Make "Got Food" a boolean.

player.gotfood = False
player.gotfood = True

Forest

if (player.gotfood=False) {
msg ("You go out hunting!")
}
else {
msg ("It was a long day, but a {random:scrawny rabbit:wriggling fish:deer) was eventually caught.<br/>")
}

Shack

if (player.gotfood=True) {
msg ("You cook the food in the back of the shack. It's not much, but at least it's hot and delicious.")
}
else {
msg ("You look at the stove and long for something to eat.")
}

OurJud
01 Nov 2016, 20:41

Thanks, Anonynn, but my game behaves a bit different to most TA. Firstyly I'm making it like a gamebook, so the player doesn't type anything. Also I'm going for a different feel and the way it works is that locations and abilities are unlocked gradually.

I'm just trying to add a Cook food option to the shack location, but only have it show if the player has been hunting.


OurJud
01 Nov 2016, 20:53

I'm getting there now. I was adding the make visible rule to the exit when I should have been adding it to the room.

Thanks for the random code, though. That's a handy one to know.