|
Author | Message |
---|
acko Novice Adventurer
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
| Subject: 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
|
|
| |
catventure Admin Adventurer
Number of posts : 404 Age : 71 Location : UK Humor : Enjoys a laugh! Adventure Points : 77 Registration date : 2008-06-08
| Subject: Re: Is objectn1 open ... ? Tue Jul 31, 2012 5:37 pm | |
| Hi Mark, Youur code looks OK 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. |
|
| |
garethfx Experienced Adventurer
Number of posts : 85 Age : 66 Location : Wales Humor : Nothing like having a good laugh - oh and a pint! Adventure Points : 53 Registration date : 2009-09-28
| Subject: 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 |
|
| |
catventure Admin Adventurer
Number of posts : 404 Age : 71 Location : UK Humor : Enjoys a laugh! Adventure Points : 77 Registration date : 2008-06-08
| Subject: 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. |
|
| |
acko Novice Adventurer
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
| Subject: 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 |
|
| |
catventure Admin Adventurer
Number of posts : 404 Age : 71 Location : UK Humor : Enjoys a laugh! Adventure Points : 77 Registration date : 2008-06-08
| Subject: 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 Your grasp of TAB syntax has grown fast as you seem to have smoothly progressed on to more advanced entry construction already... Good Luck, Phil. |
|
| |
garethfx Experienced Adventurer
Number of posts : 85 Age : 66 Location : Wales Humor : Nothing like having a good laugh - oh and a pint! Adventure Points : 53 Registration date : 2009-09-28
| Subject: 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
|
|
| |
acko Novice Adventurer
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
| Subject: Re: Is objectn1 open ... ? Thu Aug 02, 2012 10:29 am | |
| Thanks, guys 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 |
|
| |
catventure Admin Adventurer
Number of posts : 404 Age : 71 Location : UK Humor : Enjoys a laugh! Adventure Points : 77 Registration date : 2008-06-08
| Subject: 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. |
|
| |
acko Novice Adventurer
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
| Subject: 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 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 |
|
| |
Sponsored content
| Subject: Re: Is objectn1 open ... ? | |
| |
|
| |
|