Logic problem in Gamebook

OurJud
This new hobby is giving me insomnia! I lay awake for hours last night, going over my game, when I suddenly realised there was a logic issue that I'm struggling to resolve.

At one of my locations, the character is stood outside a shop (this is a location that is used more than once, as the player branches off in one of three directions, and may return). From here, he can enter the shop, find a way up to a church at the top of a hill, or return to his car.

The problem I have is that when the player is at the 'church' location, he is joined by the woman from the shop, who asks him why he's really there. This is a follow up to their conversation in the shop, and is only logical if the player has entered the shop before going up to the church. If he bypasses the shop and goes straight up to the church first, this meeting of the woman will be his first and won't make any sense.

How would I make it so that the game knows whether or not he's been in the shop, so that if he visits the church before entering the shop, I can give a slightly different description.

I suspect it'll require the use of a flag and/or some script, but I really don't know the first thing about using them.

I'm not asking for people to do it for me, but I really need step by step instructions like:

Click on the location >> Change the 'text' dropdown to 'text & script' >> Click Add a script >> Choose the 'if' script >> etc >> etc >> etc

duskdark
Hi, i was having a similar issue, sounds like you know what you need to do. Basically on the shop page I would use the add new script button and use the "set flag on" selection under variables. Then after flag name just type what you want the flag to be called. then on the pages where the player talks to the shopkeeper use the add new script button to select "if" under functions and set it to "if flag is on" and type the flag name from before (case sensitive) and then click the add new function button in the same box as the if function. (just bellow where it says "then") and use the "print message" selection. You can do the same for "if flag is off" for her dialog if the character hasn't been in her shop. you can also use "character has seen page" selection under if in the shop... but there isn't a "character hasn't seen page" option... you can also set links to new pages this way.

HegemonKhan
Conceptually:

Event1 (Scripting with the Indicators)
Indicators (Attribute set up: 'Set a variable or attribute' Scripts)
Event2 (Scripting with the Reactions)
Reactions ( 'If' Scripts using the Indicators)

for conceptual and simplified example:

page1:
game.event_flag_integer = 0
goto page2

page2:
msg ("Do you go straight to the dragon's lair to rescue the princess not needing some stupid dragon slayer sword, or do you go to the evil wizard to get the legendary dragon slayer sword?")
goto page3 or page4

page3:
msg ("You killed the evil wizard high atop his twisted tower, taking the legendary dragon slayer sword")
game.event_flag_integer = 1
goto page4

page4: msg ("You find the dark dragon at last, will you rescue the princess or join the pile of bones in the dragon's lair?")
if (game.event_flag_integer = 0) {
-> msg ("Unable to penetrate the dragon's hide, the princess screams, watching you get devoured by the dragon, except for your bones, which it spits back out onto the ground.")
} else if (game.event_flag_integer = 1) {
-> msg ("With the legendary dragon slayer sword in hand, you cut off the dragon's head with ease due to the sword's unnatural sharpness and hardness, rescuing the princess.")
}

------------

the two super scripts, which especially when used together, let's you do 90% of everything that you want to do in your game:

1. the 'set a variable or attribute' Script:

'pageX' (Page Object) -> Page (Tab) -> Page type: [Script] or [Script+Text] -> add new script or add a script -> variables -> 'set a variable or attribute' Script -> (set it up: write~type in what you want, see below)

Object_name.Attribute_name = Value_or_Expression

in GameBook version, there's only two Objects that you can use: 'game' and 'player'

Examples:

String Attributes:

game.day = "monday"
player.sex = "male"
game.strength = "strong"
player.strength = "strong"
game.greeting = "Hi, how are you doing today?"
player.greeting = "Hi, how are you doing today?"

Integer (int) Attributes:

game.level = 3
player.level = 1
player.strength = 100
game.radiation = 50
player.life = 999
player.lfe = player.life - game.radiation
player.energy = -30
game.energy = -30

Double (Floats or Floating Points) Attributes:

player.damage = 39.6
game.damage = 10.35185

Boolean (True_or_False Flags) Attributes:

game.dead = false
player.dead = false
player.dead = true
game.dead = true
player.flying = false
player.flying = true
game.flying = false
game.flying = true

instead of doing 'set a variable or attribute' Script, you can just choose 'Set flag on' or 'Set flag off', as this will also create your Boolean (Flag) Attributes:

for example:

Set a variable or attribute:
player.flying = false
^
V
Set flag off* :
Flag Name = player.flying
*Off = false

Set a variable or attribute:
player.flying = true
^
V
Set flag on* :
Flag name: player.flying
*On = true

--------------

a quick note:

Boolean~Flag Attirbutes only have two options (limited to a single option at a time), whereas String (and Integer and Double) Attributes have infinite options (but you're limited to only a single option at a time)

for example, status effects in RPGs:

player.poisoned = false // or true
player.silenced = false // or true
player.petrified = false // or true
player.confused = false // or true
player.paralyzed = false // or true
player.blinded = false // or true
player.asleep = false // or true

whereas I could just have a single String Attribute (doing what it takes 7 Boolean Attributes to do):

player.status_effect = "poisoned" // or "silenced" or "petrified" or "confused" or "paralyzed" or "blinded" or "asleep"

and then there's lists (though these are more advanced code usage)... allowing for multiple options at the same time:

player.status_effect_list = split ("poisoned;confused", ";") // the player is both 'poisoned' and 'confused' at the same time.

-----

anyways, let's get back on track, lol

2. the 'if' Script (and 'set a variable or attribute' Script):

'pageX' (Page Object) -> Page (Tab) -> Page type: [Script] or [Script+Text] -> add new script or add a script -> scripts -> 'if' Script -> [EXPRSSION] -> Object_name.Attribute_name = Value_or_Expression ->
-> then -> add a script -> (choose what Script you want here)
else if -> [EXPRSSION] -> Object_name.Attribute_name = Value_or_Expression ->
-> then -> add a script -> (choose what Script you want here)
else
-> add a script -> (choose what Script you want here)

----------------

does this help you, or are you more confused?

OurJud
More confused.

I'm really sorry, HK.... I dunno, maybe I'm just getting really really thick in my old age, and I don't want to test your patience. I also need to say that I'm very grateful for your assistance and that you explain these things so that I might understand them, rather than just repeat them parrot fashion, as it were... but, all that may have well been written in Russian.

I'm not being flippant, but honestly, it's like trying to read hieroglyphics for me :cry:

Silver
Has this not been solved?

At the shop start a script to set a flag which you could call visitedshop. Um you have to select an object so select the player object but it doesn't really matter what object you choose.

Then at the church start an IF script that checks for the flag. It will look like:

If object player has flag visitedshop

then

print message - the woman from the shop appears from behind and says blah blah

else

print message - something else.

Silver
Rather than have the script print a message you might want to get it to start a timer. Then set the timer for ten seconds or whatever then for the message to be printed. That way you give the impression that you arrive at the church and then the woman appears a short time after.

Then you have to script it so it doesn't happen each time you visit the church lol.

Silver
You would also have to move the woman object to the location if its an npc you want the player to interact with.

OurJud
Silver wrote:Rather than have the script print a message you might want to get it to start a timer. Then set the timer for ten seconds or whatever then for the message to be printed. That way you give the impression that you arrive at the church and then the woman appears a short time after.

Then you have to script it so it doesn't happen each time you visit the church lol.


Ooh, I like the timer option.

I'm going to have a go at following Silver's instructions for now, but I'm not holding out much hope for me getting there successfully.

Silver
I'm on my way home from work now. What you're asking isn't difficult but it's quite complex. I'll make a mini game when I get home and upload it to see if it helps shed any light on it.

OurJud
Thanks, SIlver, but to my surprise I did it. I used the 'If player has seen' option instead and it does what I want. Is this a viable way to do or just a workaround?

Going to have a go at that timer now.

OurJud
How the hell do I set a timer!!??

I don't see any options for 'timer' or 'countdown' in the scripts. And if I use the help database or other threads where people have asked about timers, people are saying press 'such a thing' ... and none of the things they're telling you to press exist anywhere!!

Take this for instance: http://docs.textadventures.co.uk/quest/ ... tdown.html

Is says "I highlight the player and go to Attributes and click the Add symbol."

There is no 'Attributes' anywhere.

And this from The Pixie in another thread:

If you are creating a text adventure. go to timers at the bottom on the left, and click New, type a name. Tick the Start timer button, put in the duration (say 600 for 10 minutes) and in the script box, put in what you want to happen when the time runs out. Assuming the game finishes at that point, that is all you need to do.



There is no 'timers at the bottom on the left' ??

george
I don't have Quest open at the moment but I'm guessing there is no timer option in gamebook mode. That's not to say it can't be done, but maybe it's not in the GUI.

OurJud
Ah...

Silver
I thought you were working in TA mode now? Especially given you were asking about altering the appearance of the parser. Gamebook mode is really only good for choice type games. If you want dynamic NPCs and the such then TA mode is for you really. Even if you make it look like a game book by disabling the parser and implementing the text processor.

OurJud
I have two on the go, Silver, and this thread relates to a problem I'm having setting a timer for my Gamebook adventure.

Yes, I'm trying to get the hang of TA mode because of the freedom it gives, and I have other threads for my problems there. At the moment, my biggest TA problem is getting rid of the ugly player command box, but that's on the other thread.

Silver
I quite like the ugly parser. Main reason being that people new to IF can sometimes be at a loss as to what to do so have a box saying "type something!" will at least give them a nudge on that front. :D

OurJud
:D I suppose so.

Thing is, I'm a compulsive minimalist freak, and to me it looks like a malignant wart on my design.

Silver
I am intrigued as to what the solution brings. Jay will have the answer.

OurJud
Silver wrote:I am intrigued as to what the solution brings. Jay will have the answer.

The annoying thing is, I've already found the solution, where someone explains how you get rid of it and just have the '>' followed by the flashing cursor, but I can't implement their instructions!

viewtopic.php?f=10&t=4760#p31354

Silver
I thought The Pixie said he couldn't get it to work? Anyway I'm cluless when it comes to code.

OurJud
Well he did, but the code he used wasn't the code from the thread I linked to, and in that one the asker said he got it working perfectly.

The Pixie
I tried to use the code in that thread, but failed. The posts were not that clear, and a later established an error in an earlier post, and I was not sure where. I have a feeling it may not work with the most recent version of Quest, though I cannot now remember why I thought that! What I posted here was my best try from what was on that thread, and was directed at the likes of Jay who know more JavaScript than I.

OurJud
Sorry, TP, I misunderstood. I didn't realise you'd tried the code from there.

I can use straight forward CSS to cutomise the player command box (see relevant thread) but I don't know how I save the changes I make to the CSS sheet.

Silver
If it can be done Jay will know the answer. He's an oracle.

/sycophancy

OurJud
When will he be around? My impatience is legendary... at least among my family.

Silver
No idea, I don't live with him! :D

In the meantime, this thread covers some pretty dramatic customisation of Quest using css - and the associated problems with doing so - which may or may not be of educational value:
viewtopic.php?f=18&t=4410&p=29116&hilit=gui#p29116

HegemonKhan
no worries OurJud about my post, as I was trying to explain how to do it in a hybrid fashion, half with the GUI~Editor and half with code (writing in the Expressions for your Scripts) as I don't know the GUI~Editor's script options that well (as I just work with code), so being more confused, is a common result.

If Silver doesn't make a sample game, I'll try to do so (when~if I can find the time), sighs

OurJud
Cheers, HK :D

HegemonKhan
impatience isn't that bad a thing... it's stubbornness, that can be a real problem for others, hehe ;)

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums