Using/Searching Objects in a Dark Room

Alex K
I don't know why I can't figure this stuff out on my own *sigh* I'm sorry, I'm such a newb!

Using the ONLINE EDITOR (meaning I can't just hop in and tinker super easily with code, so please answer appropriately to the abilities of the online Quest builder platform), I'm starting my character in a dark room. All I want to do is have the character search their pockets for a lighter, take out the lighter, and turn the thing on. I realize that I have to make the pocket a container in which to hold the lighter, but how the hell do I run the script to allow for the player to search their pocket in the dark room in order to find the lighter in the first place?

Treat me like I'm a complete idiot, by all means. I need the step by step starting from being able to search pockets to pulling out the lighter and "turning it on." This more advanced stuff isn't exactly covered in the tutorials.

Also, how would I do something along the line of: If a character types in that they call for help, all they get a scary gif that pops up on the screen and game over?

Alex K
If anyone asks why I don't download the full version, I don't believe it's available for a Mac, right? I kind of don't have a choice.

HegemonKhan
I haven't worked with the online version, nor have I done anything with the light~darkness yet, not do I do much work with the GUI~Editor anymore (so I don't know where to find these things below in it, though it should have for the 'add a script', a part for~on~of light~darkness scripts), but maybe these links (though they're for coding) can be of some help for you:

1. http://quest5.net/wiki/SetDark
2. http://quest5.net/wiki/SetLight
3. http://quest5.net/wiki/SetObjectLightstrength
4. http://quest5.net/wiki/CheckDarkness
5. http://quest5.net/wiki/SetExitLightstrength
6. viewtopic.php?f=18&t=3743

--------

I think with the current quest version (550), because there's so many tabs now, that they're initially toggled off, so first you'll probably have to find the option (probably in the 'game' Object ~ The Game Object), to turn on the light~darkness (or whatever it is called) tab, then in that tab (for your 'pocket' container Object), set it to being a 'weak' light source. This is just my best guess.

--------

as for your 'lighter' Object being able to be turned on (lighted up):

once you toggle the tabs to be shown, one of the tabs (whatever it is called... sorry), let's you set the Object as 'switchable' (able to turn on and turn off: such as a 'tv' Object, a 'lighter' Object, a 'lightswitch' Objects, or etc like functionality Objects).

I think quest has a built-in 'turn-on' Verb, that you can use (add) for your 'lighter' Object, and then you'll want to use these scripts (add a script) too:

SetFlagOn
SetFlagOff

explanation of the coding of this:

Boolean (flag) Type Attributes:

tv.switchedon (SetFlagOn) = true // conceptually: the 'tv' Object is 'flagged' as being 'turned on'
tv.switchedon (SetFlagOff) = false // conceptually: the 'tv' Object is 'flagged' as being 'turned off'

booleans can be shortened to this:

(usually booleans go hand-in-hand with the 'if' script)

if (tv.switchedon) {
msg ("You sit down and watch your favorite tv show for an hour.")
} else if (not tv.switchedon) {
msg (You sit down and stare at the black screen of the tv for an hour. lol")
}


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

these two 'SUPER SCRIPTS' allows you to do like 90% of everything that you want to do in your game:

the 'if' Script:

in the GUI~Editor: run as script -> add a script -> scripts -> 'if' Script -> [EXPRESSION] -> (see below)

the 'set a variable or attribute' Script:

in the GUI~Editor: run as script -> add a script -> variables -> 'set a variable or attribute' Script -> (see below)

Object_name.Attribute_name = Value_or_Expression

Examples:

player.strength_integer = 100
orc.dead_boolean = false
HK.favorite_color_string = "black"
HK.damage_expression_integer = HK.weapon_damage + HK.weapon_damage * (HK.strength - orc.endurance) / 100
etc etc etc

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

so, in full (in code), for an example:

if (orc.dead) {
msg ("The orc is already dead, silly.")
} else if (not orc.dead) {
orc.hp = orc.hp - player.damage
msg ("You attack the orc.")
if (orc.hp <= 0) {
orc.dead = true // (GUI~Editor: SetFlagOn)
msg ("And, your damage was so great, you killed the orc.")
}
}


I did everything in this script block with 'if' + 'set a variable or attribute' Scripts, except for the 'msg ~ message ~ GUI~Editor: print a message' Scripts.

---------

so, let's now use your 'lighter' Object:

(there's probably a built-in 'turn on' Verb, but let's make our own custom Verb, to show how you would do it)

'lighter' Object -> Verbs -> Add ->

Verb Name: flick_on_or_off

'flick_on_or_off' Verb Scripting:

(run as script ~ might not be needed) -> add a script -> scripts -> if -> [EXPRESSION] -> lighter.switchedon = false
-> then: add a script -> variables -> set a variable or attribute -> lighter.switchedon = true // or you can use the 'SetFlagOn' built-in script (but then you're NOT selecting: if [EXPRESSION] ~ this is only for if you rather type in: lighter.switchedon = false)
-> add a script -> ~ light-darkness -> set light strength -> room_name.lightstrength = "strong" // or something like this
-> add a script -> output -> print a message -> [MESSAGE] -> You turn on the lighter.
(add) else if: -> [EXPRESSION] -> lighter.switchedon = false
-> then: add a script -> variables -> set a variable or attribute -> lighter.switchedon = true
-> add a script -> ~ light-darkness -> set light strength -> room_name.lightstrength = "dark" // or something like this
-> add a script -> output -> print a message -> [MESSAGE] -> You turn off the lighter.

jaynabonne
Alex, here are some step-by-step instructions. It should give you an idea of what's needed. A subtle trick is that to see something in a dark room, it needs to be a weak light source. I have shown some "in progress" runs as well, so you can see how it evolves. I didn't bother with descriptions. So when you look at something you can see, it shows "Nothing out of the ordinary." The notation I'm using is that something like "room -> Objects" means "click on the 'room' object and then click on its 'Objects' tab."

game -> Features -> Check "lightness and darkness"

Add some object to the room (e.g "desk", "bed", something so you can tell when it's dark vs not)
room -> Objects -> "+ Add". Set name (in my test) to "desk".
player -> Objects -> "+ Add". Set name to "pocket". Set parent to "player". CLick OK.
room -> Light/Dark: Check "Room is intially dark"

> x pocket
It is too dark to make anything out.
> x desk
I can't see that.


pocket -> Features: check "lightness and darkness"
pocket -> Light/Dark: check "This object is a lightsource". Leave Brightness as "Weak (shown when room is dark)"

> x pocket
Nothing out of the ordinary.
> x desk
I can't see that.



pocket -> Features: check "Container"
pocket -> Container: set "Container type" to "Container"
Uncheck "can be opened"
Uncheck "can be closed"
Check "Hide children until object is looked at"
Check "List children when object is looked at or opened"


pocket -> Objects -> "+ Add": Enter "lighter" for the name and set parent to "pocket". Click OK.

> x lighter
I can't see that.
> x pocket
Nothing out of the ordinary.
> x lighter
It is too dark to make anything out.



lighter -> Features: Check "Lightness and darkness"
lighter -> Lifght/Dark: Check "This object is a lightsource". Leave Brightness as "Weak".

> x pocket
Nothing out of the ordinary.
It contains a lighter.
> x lighter
Nothing out of the ordinary.



lighter -> Features: Check "Switchable"
lighter -> Switchable: Set "Switchable" to "Can be switched on and off"
Set "Message to print when switching on (leave blank for default):" to something like "The lighter lights up the room."
Set "Message to print when switching off (leave blank for default):" to something like "The room goes dark."

> look at pocket
Nothing out of the ordinary.
It contains a lighter.
> turn lighter on
The lighter lights up the room.
> l
You are in a room.



lighter -> Switchable: create a script for "After switching on the object:".
- Click "Add new script"
- Click "Darkness" in the left list.
- Check "Set object brightness".
- Click OK.
- In the new script line, set the fields to be: "Set brightness of [object] [lighter] to [brightness] [strong]

> x pocket
Nothing out of the ordinary.
It contains a lighter.
> turn lighter on
The lighter lights up the room.
> l
You are in a room.
You can see a desk.



Do something comparable for "After switching off the object" to make the lighter brightness "weak" again.

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

Support

Forums