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
» How was it done? Implementing in-game clocks
Storing and using flag values ... I_icon_minitimeToday at 9:54 am by catventure

» How to engage in intelligent conversation with NPCs?
Storing and using flag values ... I_icon_minitimeYesterday at 9:01 pm by catventure

» refine player-available gender/name options
Storing and using flag values ... I_icon_minitimeMon Nov 18, 2024 6:04 pm by catventure

» Incubation pt 1
Storing and using flag values ... I_icon_minitimeSun Nov 17, 2024 4:22 pm by catventure

» Happy New Year 2024!
Storing and using flag values ... I_icon_minitimeSun Dec 31, 2023 4:04 pm by catventure

» TAB Version 71
Storing and using flag values ... I_icon_minitimeMon Aug 21, 2023 12:17 pm by catventure

» TAB Version 70
Storing and using flag values ... I_icon_minitimeSun Oct 02, 2022 1:49 pm by catventure

» TAB Version 70
Storing and using flag values ... I_icon_minitimeFri Sep 30, 2022 10:23 pm by catventure

» TAB Version 70
Storing and using flag values ... I_icon_minitimeMon May 23, 2022 4:08 pm by catventure


Share | 
 

 Storing and using flag values ...

View previous topic View next topic Go down 
AuthorMessage
acko
Novice Adventurer
acko

Male
Number of posts : 19
Age : 53
Location : Perth, Western Australia
Humor : No one drinks XXXX or Fosters in Australia !!
Adventure Points : 8
Registration date : 2012-07-18

Storing and using flag values ... Empty
PostSubject: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeWed Jul 18, 2012 6:35 am

Hi Phil & fellow TABers,

Quick question about the use of flags ...

Take this command, for example: flag1=room

Having tested this, the result is that the player's current location is stored in flag1.

What I can't work out is how I can use the value of flag1 in order to move the player.

For example, let's say the player starts in location 1 and picks up object 1. He then moves and a little while later finds himself in location 7. He then 'activates' (doesn't matter what it is or how he does this) object 1 and is immediately 'transported' to a new location, say location 50.

I can use flag1=room as soon as the player activates the object to store location 7 in flag1.

But then the player does something else whilst at location 50 that causes him to be teleported back to the location he came from, which is now stored in flag1.

Commands such as 'gotoflag1' or 'room=flag1' simply make TAB hang, presumebly because of the reference to flag1 and not an integer.

I know I could use a series of commands to do this but for every new location you would have to add to this list, as in ...

[start]flag1=1[acts]goto1[end]
[start]flag1=2[acts]goto2[end]
[start]flag1=3[acts]room=3#desc[end]
etc ...

My question is whether there is an easier way to do this?

Thanks all

Mark

PS. Happy adventuring ...
Back to top Go down
catventure
Admin Adventurer
catventure

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

Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeWed Jul 18, 2012 10:21 am

Hello Mark,

Welcome to this forum.

Don't think you can do that at present.

Bear with me and I'll make some new commands and post a new update.

I think what is required to solve your problem is 2 new actions:

gotoflagX - move player to room number held in flag X and describe.

room=flagX - set current room to be value held in flag X.

Be back later to let you know....

Phil (catventure)

Back to top Go down
https://adventure.forumotion.com Online
catventure
Admin Adventurer
catventure

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

Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeWed Jul 18, 2012 12:46 pm

Hi Mark,

OK. I've made a new release with the following new coding:

*NEW ACTIONS
room=flagX - set current location to be value of room integer held in flag X
gotoflagX - go to the room number held in flag X and describe the room

*NEW CONDITIONS
room=flagX
room<>flagX
room>flagX
room<flagX
room>=flagX
room<=flagX
(Check the current room number held as an integer in flagX is valid)

===
Note you can already use the following existing ACTION "flagX=Y" but with the %room% embedded tag:

flagX=%room%

eg:
flag21=%room% - set a flag to hold player current room number integer.

Also will work as a condition:

flagX=%room% - check if flagX is equal to player current room....

http://tab.thinbasic.com/

Let me know if OK.

Phil.

PS. In the case of any program crash in the player you can always retrieve the state of the database before the crash by loading the "recover.tab" datafile (navigate to main program directory) into the Editor...
Back to top Go down
https://adventure.forumotion.com Online
garethfx
Experienced Adventurer


Male
Number of posts : 85
Age : 67
Location : Wales
Humor : Nothing like having a good laugh - oh and a pint!
Adventure Points : 53
Registration date : 2009-09-28

Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeWed Jul 18, 2012 7:09 pm

I suppose you could always use TWO flags to undertake to the goto and return to action. Basically it would be something like
(in sudo code)

at location 1 "press teleport" # act flagA=%room%#room=flagX#desc

then when you need to return you could use the "press teleport"#act flagX=A#Room=flagx#desc

I think that makes some sense.

Gareth
Back to top Go down
catventure
Admin Adventurer
catventure

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

Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeWed Jul 18, 2012 7:36 pm

acko wrote:

Quote :

I can use flag1=room as soon as the player activates the object to store location 7 in flag1.

But then the player does something else whilst at location 50 that causes him to be teleported back to the location he came from, which is now stored in flag1

Now you can do something like this:

Response entries:

[start]activate object#flag1=0#here1[acts]flag1=%room%#room=50#cmessTransporting you to room 50....#desc[end]

[start]pull lever#flag1>0#room=50[acts]cmessTransporting you back to room where object was initially activated...#gotoflag1#flag1=0[end]

flag1 is reset to 0 when transported back...
here1 - checks that object 1 is held, worn or in current room

Anyway you get the idea.

Phil.
Back to top Go down
https://adventure.forumotion.com Online
acko
Novice Adventurer
acko

Male
Number of posts : 19
Age : 53
Location : Perth, Western Australia
Humor : No one drinks XXXX or Fosters in Australia !!
Adventure Points : 8
Registration date : 2012-07-18

Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeThu Jul 19, 2012 5:05 am

Excellent, Phil, thanks for that speedy fix Very Happy

And thanks for an excellent tool that is good fun to use. I think the only other time I've ever tried to create a text adventure was an app that came out for the C64 back in the 80s. And I think the severe memory limitations made for an adventure of about 4 locations, 1 puzzle and 2 objects before the whole thing crashed and you were forced to reload the app via a cassette that took half an hour!!

The request for 'gotoflag' came from an idea used in a series of fantasy books I read a couple of decades back now by a guy called Hugh Cook. In the books the main character had a bottle and a ring. When the ring was worn the wearer (and anybody touching him) was 'magically' transported into the bottle. Inside, the bottle was huge consisting of many different locations. The bottle remained behind and could be carried by another person. When the character removed the ring he could be transported back out of the bottle to the same location as the bottle: if the bottle hadn't moved since the character was inside then he'd appear at the same place, if the bottle had been moved somewhere else then he'd appear there instead.

Anyway, with your help I've got that whole thing working now with only the need for one command as opposed to the multiple needed to do it via hard-coded flag values.

It's a pity there aren't more adventure games to play other than those that come bundled with TAB.

Happy Adventuring

Mark
Back to top Go down
catventure
Admin Adventurer
catventure

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

Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitimeThu Jul 19, 2012 7:21 pm

Hi Mark,

Well I am glad that the improve is a working solution for you and cuts down considerably on the coding side of things.
If you decide to write an adventure and need help or want to request other improves or enhancements to coding actions or conditions, feel free to post up your suggestions and if they are reasonable and possible of inclusion I will do my level best to incorporate them into the TAB program as soon as practicable. Thanks for your comments and I hope you have some fun exploring TAB and maybe building your own unique interactive story idea. To this end the forum exists to provide answers to coding queries or to help shed light on many aspects of text adventure development and construction.

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




Storing and using flag values ... Empty
PostSubject: Re: Storing and using flag values ...   Storing and using flag values ... I_icon_minitime

Back to top Go down
 

Storing and using flag values ...

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: