TAB - thinBasic Adventure Builder
Would you like to react to this message? Create an account in a few clicks or log in to continue.

TAB - thinBasic Adventure Builder

T.A.B. is an interactive fiction/text adventure program for Windows and made with thinBasic.
 
HomeLatest imagesSearchRegisterLog in
Latest topics
» Happy New Year 2024!
Darkness and LightSource I_icon_minitimeSun Dec 31, 2023 4:04 pm by catventure

» TAB Version 71
Darkness and LightSource I_icon_minitimeMon Aug 21, 2023 12:17 pm by catventure

» TAB Version 70
Darkness and LightSource I_icon_minitimeSun Oct 02, 2022 1:49 pm by catventure

» TAB Version 70
Darkness and LightSource I_icon_minitimeFri Sep 30, 2022 10:23 pm by catventure

» TAB Version 70
Darkness and LightSource I_icon_minitimeMon May 23, 2022 4:08 pm by catventure

» TAB Version 70
Darkness and LightSource I_icon_minitimeSat Apr 30, 2022 11:15 am by catventure

» TAB Version 70
Darkness and LightSource I_icon_minitimeSat Apr 23, 2022 2:32 pm by catventure

» TAB Version 68 Update
Darkness and LightSource I_icon_minitimeTue Mar 15, 2022 4:18 pm by catventure

» TAB Version 68 Update
Darkness and LightSource I_icon_minitimeFri Mar 11, 2022 8:47 pm by catventure


Share | 
 

 Darkness and LightSource

View previous topic View next topic Go down 
AuthorMessage
catventure
Admin Adventurer
catventure

Male
Number of posts : 404
Age : 71
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Darkness and LightSource Empty
PostSubject: Darkness and LightSource   Darkness and LightSource I_icon_minitimeSat Jul 19, 2008 5:48 pm

Hello,

The next release will make it easier to deal with creating dark locations and the possibility of setting an object as a "lightsource".

It will work similar to method CAT although in TAB "ANY" object can be a lightsource! You are not restricted to just Object 200 as was the case previously...

I'm trying to make it as simple and automatic as I can.

To make an object a lightsource you will simply tick the checkbox on the Object Editor when you create such an object.

To make a location a dark location you will simply prefix the BRIEF description with a "!" exclamation mark eg:
"!TWISTY HALLWAY."
or just:
"!"
if you don't want a brief description.

Whenever the player visits or does a room describe of a dark location TAB will show instead System Message 78:

"Its dark. You can't see anything"

Also the BRIEF description in the StatusBar of the Window will be made blank in dark locations.

Exits, Objects visible and Characters present in a "dark" location will also not be printed.

Of course if the player owns (carries or wears) a lightsource or a lightsource object exists in a dark room then the location will be described as normal.

You will also be able to stop the player carrying out certain actions in a dark room as well.

A simple coding entry placed strategically in RESPONSE will do the trick.

In the next "character_demo.tab" datafile I have made it so the player can only move using directions and nothing else...

Any other commands typed by player are subject to this entry:

[start]%_%#room=2#absent4[acts]sysmess79[end]

If the lit "brass lamp" is absent then

Prints "It's too dark to do that." (sysmess 79)

The player must move to a lit location before normal service resumed Smile

If you had more than one "lightsource" object the above entry can be modified to take care of that:

[start]%_%#room=2#absent4#absent16#absent25[acts]sysmess79[end]

In graphic games the location pictures for "dark" rooms will not be shown.

I would like your opinions on whether to stop the reporting of character movements while the player is in darkness...

Should they be turned off or on while a room is dark? They would still move - it's just the player would not see the reporting messages.. Or would you like me to create a new action to give the author the option of doing this or not?

EDIT:

I've also made 2 new conditions:
dark - true if room is currently dark
notdark - true if room is light

They could be used for puzzles relying on darkness or light.


Regards,
catventure.


Last edited by catventure on Sun Jul 20, 2008 3:01 pm; edited 2 times in total
Back to top Go down
https://adventure.forumotion.com
catventure
Admin Adventurer
catventure

Male
Number of posts : 404
Age : 71
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitimeSun Jul 20, 2008 12:13 pm

Hi,


Locations can be set to be dark by preceding the BRIEF text field description for a location with an exclamation mark symbol - ! in the LOCATION EDITOR.

Whenever TAB meets such a location text starting it assumes that location is dark and instead of printing the normal location description and exits etc. it will cause System message 78: 'It's dark. You can't see anything.' to be output when the player moves to that location or when the command 'look' is typed in that location.

However, if the player is carrying or wearing a source of light or if a source of light is in that location then TAB will show any picture and text description for the location as normal.

In the case of a lightsource such as a "torch" - it may be necessary to create another "torch" object; so you can have an "unlit torch" and a "lit torch" - only one of which existed in the game at any given time...

It will also be profitable to examine the type of RESPONSE entries that would deal with switching or turning on and off a torch. They should first check which torch is being carried or in the current location and then if the entry conditions are true, the two torches should be swapped around and an appropriate message output.

Another little touch that should be added when the torch is swapped should be to change the 'itnoun' variable to the new torch number.

The 'itnoun' variable keeps track of the last referenced noun and replaces subsequent phrases containing 'it' or 'them' with the value it holds.
So if we swap an unlit torch for a lit torch we must ensure that 'itnoun' is informed of the change by setting it to the new object value of the lit torch and vice versa. This is in case the player types 'switch on torch and examine it'.

'it', in this case would refer to the lit torch and not the unlit torch, so providing 'itnoun' is set to the new value the system will respond correctly.
A similar entry needs to exist for when the torch is turned off.

Let us assume that Object 7 is 'an unlit torch', and Object 8 is 'a lit torch' and Object 8 is checked as a "lightsource" and also that '/switch/turn/', '/torch/', '/off/' and '/on/' are present in the correct Vocabulary lists.

Also, assume Message 201 reads 'The torch is now on.' and Message 202 reads 'The torch is now off.' We will further assume that both objects have the same weight and that the lit torch starts off not created. (Location 0)

Here is the sort of thing which might be needed in a game when the player owns the unlit torch and wishes to turn it on:


[start]switch torch on/switch on torch#here7[acts]swapobjs7,8#objn2=8#itnoun=objn2#mess201[end]

[start]switch torch off/switch off torch#here8[acts]swapobjs8,7#objn2=7#itnoun=objn2#mess202[end]


The 2 objects exchange places.

'Dark' locations can be used for underground systems, dungeons, or cave mazes and the like.
If you use dark locations ensure that the player can find and use an object lightsource to help him/her.

You can avoid such code as above if your object is a permanently lit or bright item. One that will always provide light such as a "magic lamp". This saves making 2 objects with the same noun name and the resultant extra coding needed.

There is some extra code needed in Response to handle the 2 different "torches" and I will cover that in a following post in this thread.

"character_demo.tab" will include an example of such code in the next release.

Regards,
catventure.


Last edited by catventure on Sun Jul 20, 2008 3:06 pm; edited 1 time in total
Back to top Go down
https://adventure.forumotion.com
catventure
Admin Adventurer
catventure

Male
Number of posts : 404
Age : 71
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitimeSun Jul 20, 2008 1:57 pm

Hi,

Continuing the little foray into the world of darkness, I promised to tell you what extra entry was needed in Responses Editor. The below special Response entry will be required because there are TWO "torch" objects that can be referred to in the game...

Object 7 is an unlit torch
Object 8 is a brightly lit torch

Now a bit of explanation:
When TAB parses an input line typed by the player it will extract the FIRST occurrence in the Vocabulary lists for a matching word or synonym and then convert it to the KEYWORD so as to process the Response list of entries. This means that either or both the parser variables "objn1" and "objn2" will be holding a value of 7 should the player have typed eg:

switch on torch

or,

switch torch on

or, if they have been extremely silly, something like:

switch torch on torch

One or both of those object noun parser variables will hold a value of 7 irrespective of which torch exists in the game.

So we need to put ONE single special entry right at the beginning of Response that starts with words conditions:

%_%

which means the entry will trigger WHATEVER command the player types in.

We need to do this to check the "words conditions" every time in case the player has typed a phrase containing an object noun "torch". Why? Because we need to change the object noun(s) numbers from 7 to hold a value of 8 should the unlit torch no longer exist in the game after it is swapped for the lit torch when the unlit torch is turned on. In other words this rather complex looking entry ensures that the correct torch object will be used and recognised by TAB

Here it is:

[start]%_%#objn2=7#objn1=7#objloc7=0[acts]objn1=8#objn2=8#jumpSTART#else#objn1=7#objn2<>7#objloc7=0[acts]objn1=8#jumpSTART#else#objn2=7#objn1<>7#objloc7=0#objn2=8#jumpSTART[end]

following this we create a LABEL in the Response list. I've called the label START (but you can call it anything you like) The LABEL goes directly under the entry and has a colon appended to it like so:

START:

The "jumpLABEL" action - if done - will cause TAB to JUMP to the named label BELOW and then continue checking Response entries from that point to find a match.

Analyzing the entry carefully you will see that it looks to see IF parser variables "objn1" and/or "objn2" are equal to 7. IF the unlit torch has been destroyed (removed from game) and set to location 0 THEN it sets the objn1 and/or objn2 to be 8 (number of lit torch) instead.

If this entry was done by TAB it will carry out all subsequent player actions and commands regarding the torch as if it were the "lit torch" (with its lightsource attribute)

eg:

>examine torch

The torch glows brightly with a strong beam of light.

When the torch is switched off and the 2 torches have exchanged places again the above entry will be scanned but not done because the unlit torch (Object 7) will now exist and no longer be in location 0... so TAB will "know" that it is now the unlit torch which needs to be acted upon.

eg:

>examine torch

The torch has an on/off switch. It is currently OFF.

The entries above regarding a "torch" can be modified for any similar scenario in your own games and is placed here as reference material.

Best wishes,
catventure.
Back to top Go down
https://adventure.forumotion.com
Pippa's Ghost
Novice Adventurer


Number of posts : 8
Adventure Points : 0
Registration date : 2008-08-31

Darkness and LightSource Empty
PostSubject: Darkness and LightSource in Character Demo game   Darkness and LightSource I_icon_minitimeSun Aug 31, 2008 5:02 pm

You mentioned using darkness in the Character Demo game. There seems to a problem there.

If I put the lit lamp in the box, the room becomes dark, too dark even for me to take the lamp back out of the box again.

Is this a bug? I could understand it becoming dark if I closed the box with the lamp in it, but not just for putting it in. I mean, some light should still escape, shouldn't it?
Back to top Go down
catventure
Admin Adventurer
catventure

Male
Number of posts : 404
Age : 71
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitimeSun Aug 31, 2008 5:16 pm

Hi Pippa,

You are right. I noticed some time ago this was a possibility and meant to do something about it; so yes - I will change for next release. Embarassed

Well spotted!

Regards,
catventure.
Back to top Go down
https://adventure.forumotion.com
Pippa's Ghost
Novice Adventurer


Number of posts : 8
Adventure Points : 0
Registration date : 2008-08-31

Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitimeSun Aug 31, 2008 5:27 pm

Ok. Thanks.
Back to top Go down
MidKnight
Apprentice Adventurer
MidKnight

Male
Number of posts : 32
Age : 54
Location : Haworth Yorkshire
Humor : I am a Vulcan, I don't have emotions
Adventure Points : 0
Registration date : 2008-06-08

Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitimeMon Sep 01, 2008 8:11 pm

>Is this a bug? I could understand it becoming dark if I closed the box with the lamp in it, but not >just for putting it in. I mean, some light should still escape, shouldn't it?

I've been playing adventure games since the late 70's. I rate dark/light as I do mazes. Seen enough of it. I remember when the first day/night came into adventure games. It was an interesting yet not very thought out idea.

I'm considering doing a day and night in my game. A watered down version so your not stumbling around in the dark. Take some doing as it effects alot of elements.

Jason
Back to top Go down
catventure
Admin Adventurer
catventure

Male
Number of posts : 404
Age : 71
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitimeFri Sep 12, 2008 5:26 pm

Pippa's Ghost wrote:

If I put the lit lamp in the box, the room becomes dark, too dark even for me to take the lamp back out of the box again.
Is this a bug? I could understand it becoming dark if I closed the box with the lamp in it, but not just for putting it in. I mean, some light should still escape, shouldn't it?

Hi Pippa.

In this morning's revision update I made it so you can get the lamp out of the box in the "dark" room.
I'm still thinking of possibly making some new actions connected with darkness and light...

Regards,
catventure.
Back to top Go down
https://adventure.forumotion.com
Sponsored content




Darkness and LightSource Empty
PostSubject: Re: Darkness and LightSource   Darkness and LightSource I_icon_minitime

Back to top Go down
 

Darkness and LightSource

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
TAB - thinBasic Adventure Builder :: TAB FORUMS :: General Forum-
Jump to: