Flag issue

OurJud
24 Dec 2015, 13:23
Got a head scratcher.

This is the script for when the player arrives at the destination.

firsttime {
if (GetBoolean(player, "trunkopen")) {
msg ("As the vehicle comes into focus it's clear it's unoccupied, and has been for some time. The passenger door and both rear doors hang open. The hood is off its latch and the trunk is open.<br/><br/>The road here swings to the west. Back to the south the path rises to a crest.")
}
else {
msg ("As the vehicle comes into focus it's clear it's unoccupied, and has been for some time. The passenger door and both rear doors hang open. The hood is off its latch and the trunk is open.<br/><br/>The road here swings to the west. Back to the south the path rises to a crest.")
}
}
otherwise {
if (GetBoolean(player, "trunkopen")) {
msg ("There's a an abandoned car here. The passenger door and both rear doors hang open. The hood is off its latch and the trunk is open..<br/><br/>The road here swings to the west. Back to the south the path rises to a crest.")
}
else {
msg ("There's a an abandoned car here. The passenger door and both rear doors hang open. The hood is off its latch. Trunk is closed tight.<br/><br/>The road here swings to the west. Back to the south the path rises to a crest.")
}
}


If the player doesn't have the flag 'trunkopen' it should give the description saying the 'trunk is closed tight', but I'm getting 'trunk is open' instead. The only place the flag is set, is when the player successfully gain access to the locked trunk.

OurJud
24 Dec 2015, 13:27
Sorry, I really need to double check things before jumping into the forum.

I had 'trunk open' in the first else description, when it should have been 'trunk closed'

jaynabonne
24 Dec 2015, 19:51
Given the text is largely the same, you might be able to use the text processor to simplify things. Something like:

msg ("As the vehicle comes into focus it's clear it's unoccupied, and has been for some time. The passenger door and both rear doors hang open. The hood is off its latch and the trunk is {if trunkopen:open}{if not trunkopen:closed}.<br/><br/>The road here swings to the west. Back to the south the path rises to a crest.")

OurJud
24 Dec 2015, 21:56
That's a useful tip - didn't even know you could code text like that - but it doesn't incorporate the 'second visit' description.

Forgewright
24 Dec 2015, 22:14
That's what I do Jay...good advice

jaynabonne
24 Dec 2015, 22:58
OurJud wrote:That's a useful tip - didn't even know you could code text like that - but it doesn't incorporate the 'second visit' description.

Sorry, yes, that's just one branch. You would do the same for the other branch. It just gets rid of the if/else in the code.

OurJud
24 Dec 2015, 22:59
Ah, I see. Thank you.