Axe Software Forums
  Quest Developer Forum
  Guess whoooooo? Problem with prefixes this time


Author Topic:   Guess whoooooo? Problem with prefixes this time
Mega posted 11-10-2001 04:20 GMT     
This ties in to the previous "door" problem. Within the object type definition, I told it to set the door's 'prefix' tag to 'Closed', which it did perfectly. I want the object's 'open' action, along with all the other script, to change the prefix to 'Open', and the 'close' action to change it back again. However, when I try to do this -- with the exact same code that worked the first time -- it doesn't work now. What am I doing wrong?
Also, is there a way to have that prefix appear in the little 'Objects in room' window? I've never been able to do that unless I change the 'alias' tag as well.
Here's the code; I'll just post the object type definition, which I modified from Al's code:

define type <openable>
'this line works:
property<$thisobject$; prefix=Closed;>
closed
properties <lookcloseddesc = null>
properties <lookopendesc = null>
properties <closedesc = null>
properties <opendesc = null>

action <open> {
'this line doesn't work:
property< $thisobject$ ;prefix=Open>
set string <lookedat; $thisobject$>
if property <$thisobject$; closed> then {
if ($objectproperty(#lookedat#; opendesc)$ = null) then {
property <$thisobject$ ;opendesc =You open the #lookedat#.>
}
else {
property <$thisobject$ ;opendesc = $objectproperty(#lookedat#; opendesc)$>
}
property <$thisobject$; not closed>
msg <$objectproperty(#lookedat#; opendesc)$>
}
else msg <The #object# is already open.>
}

action <close> {
'Neither does this one:
property<$thisobject$; prefix=Closed;>
set string <lookedat; $thisobject$>
if not property <$thisobject$;closed> then {
if ($objectproperty(#lookedat#; closedesc)$ = null) then {
property <$thisobject$ ;closedesc =You close the #lookedat#.>
}
else {
property <$thisobject$ ;closedesc = $objectproperty(#lookedat#; closedesc)$>
}
property <$thisobject$; closed>
msg <$objectproperty(#lookedat#; closedesc)$>
}
else msg <The #object# is already closed.>
}

action <look> {
set string <lookedat; $thisobject$>
if property <$thisobject$; closed> then {
if ($objectproperty(#lookedat#; lookcloseddesc)$ = null) then {
set string <lookmessage ;The #lookedat# is closed>
}
else {
set string <lookmessage ;$objectproperty(#lookedat#; lookcloseddesc)$>
}
}
else {
if ($objectproperty(#lookedat#; lookopendesc)$ = null) then {
set string <lookmessage ;The #lookedat# is open>
}
else {
set string <lookmessage ;$objectproperty(#lookedat#; lookopendesc)$>
}
}
msg <#lookmessage#.>
}

end define

MaDbRiT posted 11-10-2001 09:15 GMT          
Hi

This doesn't work because of a very simple syntax error, you will kick yourself for this ;-)

quote:

'this line doesn't work:
property< $thisobject$ ;prefix=Open>

try this..

quote:

property <$thisobject$; prefix=Open>

Yup - as per the Quest manual you are supposed to leave a space between the statement and parameter marker ( 'property' & '<' )

Quest doesn't enforce this styntax totally religiously, but it DOES make a difference on occasions. Here is a case in point.

AFAIK the only way to affect what shows in the 'objects' box is to use the 'alias' tag.

Al

Mega posted 12-10-2001 06:38 GMT          
Thankee kindly, that worked perfectly! (And yes, I am kicking myself...very hard...owwww)
MaDbRiT posted 12-10-2001 09:55 GMT          
T'was the easiest question you've posed yet Mega :-)

Al

Computer Whizz posted 12-10-2001 19:17 GMT          
And would:
property < $thisobject$ ; prefix = whatever >
cause any problems?

or would Quest cope with the spaces? I just want to make sure that I don't get error codes all the time :)

Computer Whizz

MaDbRiT posted 12-10-2001 20:09 GMT          
It shouldn't do, Quest insists on the gap between (say) 'property' & '<' but apparently strips out other spaces.

That's what it says in my manual anyway - LOL

Al