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 | 
 

 Is objectn1 open ... ?

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: Is objectn1 open ... ?   Tue Jul 31, 2012 9:13 am

Hi (again) Phil,

Could you help me out with checking for open/closed containers please ...

Take the following from my 'character commands' script when I ask a character to do something:

[start]climbŻinto %objn1%#objlocn1=charloc%speech%#objn1container[acts]cmess%speechname% climbs into the %objn1%.#charloc%speech%=objlocn1#else#objlocn1=charloc%speech%[acts]cmess%speechname% looks at you oddly, and says "I can hardly do that, the %objn1% is closed".[end]

Let's say the object in question is something that can be opened and closed ... so I only want the character to be able to climb into it if the object is open.

What I think I need is two other conditions of, objn1opened and objn1closed, as in:

[start]climbŻinto %objn1%#objlocn1=charloc%speech%#objn1container#objn1opened[acts]cmess%speechname% climbs into the %objn1%.#charloc%speech%=objlocn1#else#objlocn1=charloc%speech%objn1closed[acts]cmess%speechname% looks at you oddly, and says "I can hardly do that, the %objn1% is closed".[end]

And although there are entries for things like container (used above), wearable, static etc ... I can't see one specific to the open or closed status of the object.

Yes, I could hard-code the object number using openedX (i.e. opened2) but that wouldn't make the above entry fully generic for all openable/closeable containers.

I tried using openobjn1 and closedobjn1 but they seem to be for setting the status of the container to either open or closed, not for condition checking. I also tried using openedx but this only seems to allow 'x' to be an integer, and not a reference to the object noun as input by the player.

Or maybe I just can't see the wood for the trees?

Also, is #then# supported in the 'character commands' script? I seem to get an error when I try and use it (action #then# is invalid).

Cheers

Mark

Back to top Go down
View user profile
catventure
Admin Adventurer
avatar

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

PostSubject: Re: Is objectn1 open ... ?   Tue Jul 31, 2012 5:37 pm

Hi Mark,

Youur code looks OK Smile

Conditions to check for if container obj is open:

openobjn1
closedobjn1

*think you may be looking for above two...*

openobjn2
closedobjn2

openedX
closedX


"then" was an old extension which is no longer supported and was causing problems so it is discontinued and will not work.

See the "call_condition" and "call_action" notes in the "language.txt" file

Best wishes,
Phil.

_________________
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: Is objectn1 open ... ?   Tue Jul 31, 2012 5:43 pm

Hi Mark

first you really need to se up a routine to open/close the objn1container.

its~

[start]open objn1container#here199#flag59=1[acts]cmessThe objn1container is already open![end]

[start]open objn1container#here199#flag59=0[acts]cmessOK.The objn1container is open now!#flag59=1[end]

[start]close objn1container#here199#flag59=1[acts]cmessOK.It's closed now!#flag59=0[end]

[start]close objn1container#here199#flag59=0[acts]cmessYou can't. It's already closed.[end]

The use of a flag in this case flag59 will be set at 0(zero) to be closed and 1 (one) as open - The flag used of course is your decision.


Then in your examplar code it will set like:-



[start]climbŻinto %objn1%#objlocn1=charloc%speech%#objn1container=here#flag59=1#[acts]cmess%speechname% climbs into the %objn1%.#charloc%speech%=objlocn1#else#objlocn1=charloc%speech%#objn1container=here#flag59=0#[acts]cmess%speechname% looks at you oddly, and says "I can hardly do that, the %objn1% is closed".[end]

In this case as you see ive tested that the OBJN1CONTAINER is in the location as well

(unless Phil you see something else here)

Gareth
Back to top Go down
View user profile
catventure
Admin Adventurer
avatar

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

PostSubject: Re: Is objectn1 open ... ?   Tue Jul 31, 2012 6:42 pm

Hi gareth,

objn1container=here - don't think this a valid condition
Should be:

objlocn1=here

check if object n1 is carried worn or in current room.

But anyway Gareth I don't think this will apply in Mark's "speech" entry because the location of the container must be at the same location as the character and not necessarily the player's room.....; also I think he has it covered already to an extent with the condition:

#objlocn1=charloc%speech%#

is the location of object n1 the same as the speech character's location?

So I think the entry should be:

[start]climbŻinto %objn1%#objlocn1=charloc%speech%#objn1container#objn1open[acts]cmess%speechname% climbs into the %objn1%.#charloc%speech%=objlocn1#else#objlocn1=charloc%speech%#objn1closed[acts]cmess%speechname% looks at you oddly, and says "I can hardly do that, the %objn1% is closed".[end]


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: Is objectn1 open ... ?   Wed Aug 01, 2012 5:32 am

Finally settled on:

[start]climbŻinto %objn1%#objlocn1=charloc%speech%#objn1container#openobjn1[acts]cmess[color=%rgb_darkblue]%speechname% climbs into the %objn1%.#charloc%speech%=objlocn1#else#objlocn1=charloc%speech%#objn1container#closedobjn1[acts]cmess[color=%rgb_darkblue]%speechname% looks at you oddly, and says "The %objn1% is closed".[end]

Just switched around the command syntax in your last one, Phil ... objn1open to openobjn1 and objn1closed to closedobjn1.

Works like a dream without any need for flags which, in my opinion, are a pain to keep track of even if you do have them written down.

Also added a couple of other commands to allow characters to open and close container objects:

[start]open %objn1%#objlocn1=charloc%speech%#objn1container#closedobjn1#objn1=2[acts]cmess%speechname% opens the %objn1%.#openobjn1#else#objlocn1=charloc%speech%#objn1container#openobjn1[acts]cmess%speechname% says "Why would I need to do that, the %objn1% is already open!".[end]

[start]close %objn1%#objlocn1=charloc%speech%#objn1container#openobjn1#objn1=2[acts]cmess%speechname% closes the %objn1%.#closeobjn1#else#objlocn1=charloc%speech%#objn1container#closedobjn1[acts]cmess%speechname% says "Why would I need to do that, the %objn1% is already closed!".[end]

Cheers

Mark
Back to top Go down
View user profile
catventure
Admin Adventurer
avatar

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

PostSubject: Re: Is objectn1 open ... ?   Wed Aug 01, 2012 9:37 am

Hi Mark,

Yes you're right - I wrote the conditions wrongly in my example and they needed reversing Embarassed

Your grasp of TAB syntax has grown fast as you seem to have smoothly progressed on to more advanced entry construction already... Smile

Good Luck,
Phil.

_________________
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: Is objectn1 open ... ?   Wed Aug 01, 2012 12:46 pm

@ Phil - Hi mate I copied the use of the objn1container from marks code - Id not seen that before anywhere and thought (wrongly) that it was sudo code



But I have to commend Mark on that piece of code WOW.......Well done !


Its great to see it as its the type of code which is good to keep in a "catalogue" for people who are new (like me) and can learn to add these things into our games as well..... Use it and learn

well done

Back to top Go down
View user profile
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: Is objectn1 open ... ?   Thu Aug 02, 2012 10:29 am

Thanks, guys Very Happy

Whilst I have your ear, and on another matter entirely ... how do you use the 'sizex' command.

For instance, I have created object 3, but if I have the following in script 2:

[start]size3<0[acts]cmess size < 0[end]
[start]size3=0[acts]cmess size = 0[end]
[start]size3=1[acts]cmess size = 1[end]
[start]size3=2[acts]cmess size = 2[end]
[start]size3>2[acts]cmess size > 2[end]
[start]size3=3[acts]cmess size = 3[end]

I get the following messages, when object 3 is set to size 0:
size = 0
size = 1
size = 2
size = 3

I get no messages when object 3 is set to size 1 or 2:

I get the following message when object 3 is set to size 3 or greater:
size > 2

Either I have the syntax wrong or it isn't possible to test the size of an object and act on it.

I also notice that the following throws an error in script 2:

[start][acts]size3=2[end]

So in a nutshell I'm asking (1) can the size of an object be tested for as a condition?, and (2) can you change the size of an object during a game?

Cheers

Mark
Back to top Go down
View user profile
catventure
Admin Adventurer
avatar

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

PostSubject: Re: Is objectn1 open ... ?   Thu Aug 02, 2012 7:20 pm

Hi Mark,

Yes I've checked and you're right the following CONDITIONS are NOT working properly:

sizeX=Y
sizeX<Y
sizeX>Y

There are no "size" actions - so shouldn't be used as in your second example.

Please bear with me while I make the fixed update.

Thank you,
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: Is objectn1 open ... ?   Fri Aug 03, 2012 4:18 am

Hey Phil,

Ta very much for fixing up the size conditions, they work like bought ones!

Just on the subject of size actions ... is there a way that sizex and objn1size actions could be added Question It would be nice to be able to change the size of an object on the fly, so to speak (e.g. objn1size=4, where previously the size of objn1 was 5).

Ta

Mark
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Is objectn1 open ... ?   

Back to top Go down
 

Is objectn1 open ... ?

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: