TAB - thinBasic Adventure Builder

T.A.B. is an interactive fiction/text adventure program for Windows and made with thinBasic.
 
HomeFAQSearchUsergroupsRegisterLog in
Latest topics
» TAB Version 66 Available
Mon Sep 26, 2016 12:02 pm by catventure

» TAB Version 65 Available
Mon Feb 23, 2015 12:04 pm by catventure

» Incubation pt 1
Wed Apr 24, 2013 9:24 am by Kabrinski

» Charecter movements - doors
Wed Mar 20, 2013 2:55 pm by garethfx

» Member feedback on game planning
Sun Mar 03, 2013 1:47 pm by garethfx

» Still alive - just!
Thu Feb 28, 2013 11:34 am by catventure

» TAB 64 crashes ...
Mon Aug 20, 2012 11:31 am by acko

» Idea on addition to object being container
Sat Aug 18, 2012 3:49 pm by catventure

» sizex=y action ...
Thu Aug 09, 2012 11:29 am by catventure


Share | 
 

 Storing and using flag values ...

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

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

PostSubject: Storing and using flag values ...   Wed 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
View user profile
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 65
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: Storing and using flag values ...   Wed 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)


_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.com
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 65
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: Storing and using flag values ...   Wed 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...

_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.com
garethfx
Experienced Adventurer


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

PostSubject: Re: Storing and using flag values ...   Wed 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
View user profile
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 65
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: Storing and using flag values ...   Wed 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.

_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.com
acko
Novice Adventurer
avatar

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

PostSubject: Re: Storing and using flag values ...   Thu 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
View user profile
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 65
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: Storing and using flag values ...   Thu 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.

_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.com
Sponsored content




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

Back to top Go down
 

Storing and using flag values ...

View previous topic View next topic Back to top 

 Similar topics

+
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: