Changing Prefix Variable
bds1313
26 Jan 2004, 20:24I have an object created with a prefix of <a>. I've created a script that when the object is spoken to, it adds an alias (character name) to a generic object name. <this works fine>
The script also pops up a menu for conversation. <this also works fine>
The problem I'm encountering is, I need to remove the original prefix when the script is executed and return it to a "null" or "false" state.
I've looked at multiple posts and websites and can't seem to accomplish this. Does anyone know if this is possible? It looks terrible to run "look" and see "In the room are a (character name). Any help would be appreciated. - Thanks
The script also pops up a menu for conversation. <this also works fine>
The problem I'm encountering is, I need to remove the original prefix when the script is executed and return it to a "null" or "false" state.
I've looked at multiple posts and websites and can't seem to accomplish this. Does anyone know if this is possible? It looks terrible to run "look" and see "In the room are a (character name). Any help would be appreciated. - Thanks
I think Im Dead
26 Jan 2004, 21:57Not entirely clear on what you're wanting but if it's just change the prefix back to blank, did you try...
property <object; prefix= >
property <object; prefix= >
bds1313
27 Jan 2004, 01:12Let me see if I can explain better.
I have an object in a room called Bartender. When you speak to the bartender, he tells you his name. I have a property change to add an Alias to the Bartender with his name. (This part works).
The Bartender object has a prefix of "a". Once I add the alias (Bartender name), I need to clear out the prefix field. This way, when you do a "look" on the room, it doesn't say "a (Bartender's name)."
I have tried ... property <object; prefix= > ... and it still returns the original prefix of "a". I'm kind of lost at this point.
I have an object in a room called Bartender. When you speak to the bartender, he tells you his name. I have a property change to add an Alias to the Bartender with his name. (This part works).
The Bartender object has a prefix of "a". Once I add the alias (Bartender name), I need to clear out the prefix field. This way, when you do a "look" on the room, it doesn't say "a (Bartender's name)."
I have tried ... property <object; prefix= > ... and it still returns the original prefix of "a". I'm kind of lost at this point.
iamdaman13
27 Jan 2004, 04:27I think I understand your question.
All you would have to do is create a duplicate of the bartender, which at first is hidden and inaccessible. This duplicate should include the changes you want to make to the bartender after speaking to him. Include scripting for the first bartender object that basically says "when spoken to, hide and make inaccessible this object, and reveal and make accessible the duplicate bartender."
I tried to explain it. Hope it helps.
All you would have to do is create a duplicate of the bartender, which at first is hidden and inaccessible. This duplicate should include the changes you want to make to the bartender after speaking to him. Include scripting for the first bartender object that basically says "when spoken to, hide and make inaccessible this object, and reveal and make accessible the duplicate bartender."
I tried to explain it. Hope it helps.
I think Im Dead
27 Jan 2004, 04:47Eh even easier for this would be to just ignore using a prefix altogether, and give the bartender an original alias of "a bartender" and a property of name with a value of "Bob McGee"(or whatever the guys name is). Set the speakto script so that after the bartender talks and introduces himself it runs a script something like...
property <bartender; alias=$objectproperty(bartender; name)$>
sometimes quest can be picky about using the calling object properties from the same object(or it used to...) but that should work. The only downside is that the "a bartender" will now be "a bartender" and you would have to type, "speak to a bartender", but to resolve the last issue just add bartender to the alt names tag thing.
There's also a complicated way of checking if the character has been spoken to and revealing his name based on that, but it's more complex than I think you want.
property <bartender; alias=$objectproperty(bartender; name)$>
sometimes quest can be picky about using the calling object properties from the same object(or it used to...) but that should work. The only downside is that the "a bartender" will now be "a bartender" and you would have to type, "speak to a bartender", but to resolve the last issue just add bartender to the alt names tag thing.
There's also a complicated way of checking if the character has been spoken to and revealing his name based on that, but it's more complex than I think you want.
Anonymous
27 Jan 2004, 11:20following on from the above;
Attention Alex! this is a BUG...
I'm with I.T.I.D. on this - easiest workaround is to use the alias property and ignore the prefix tag/property entirely, making use of the ALT names to get response to the other possible names.
That said, it is a wierd bug because the use of
actually seems to be working if you use the property viewer, but if the parameter is <prefix= > Quest's #quest.objects# still uses the originally coded tag/property, so it may be that the error lies somewhere in the building of the room variables rather than in the prefix property itself.
Just for the hell of it - here's the alias version working:
Al (MaDbRiT)
Attention Alex! this is a BUG...
I'm with I.T.I.D. on this - easiest workaround is to use the alias property and ignore the prefix tag/property entirely, making use of the ALT names to get response to the other possible names.
That said, it is a wierd bug because the use of
property <object; prefix = >
actually seems to be working if you use the property viewer, but if the parameter is <prefix= > Quest's #quest.objects# still uses the originally coded tag/property, so it may be that the error lies somewhere in the building of the room variables rather than in the prefix property itself.
Just for the hell of it - here's the alias version working:
' Created with QDK Pro 3.51
define game <>
asl-version <350>
gametype singleplayer
start <test>
game info <Created with QDK Pro 3.51>
end define
define synonyms
end define
define room <test>
define object <Fred>
alias <a bartender>
displaytype <person>
alt <Fred; bartender; the bartender; a bartender>
speak {
say <My name is Fred, hiya buddy.>
property <Fred; alias=Fred>
}
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end define
Al (MaDbRiT)
bds1313
27 Jan 2004, 12:51Thanks for the replys on this. It will certainly get me past my problem. I just find it weird that you can't just use "property<object; prefix=>" or that there is no variable for "null" or "false" so you could then type "property<object; prefix="null">". Anyway, thanks again. I have a huge multiplayer game in development and that problem was killing me all day yesterday. 
Alex
27 Jan 2004, 12:55I think Quest is seeing the empty property as not existing, so it reverts to using the tag. The simple workaround for this is not to use the prefix tag when setting up your object, but instead to put
property <prefix=a>
in your object definition.
property <prefix=a>
in your object definition.
bds1313
27 Jan 2004, 13:00Alex, could you then use a "not property <prefix=a>" to turn it off? If so, this will definately solve my problem.
I think I'm dead The complex way you discussed about determining if someone has been spoken to, can that be done for different players? If I'm creating a multiplayer game, I would think that after the first player spoke to the bartender, the bartender's name would then appear for all other players. If the script you have will make it so that each person has to speak to the bartender to see his name, I'm all for that. Let me know.
I think I'm dead The complex way you discussed about determining if someone has been spoken to, can that be done for different players? If I'm creating a multiplayer game, I would think that after the first player spoke to the bartender, the bartender's name would then appear for all other players. If the script you have will make it so that each person has to speak to the bartender to see his name, I'm all for that. Let me know.
Anonymous
27 Jan 2004, 14:06Alex wrote:
I suspected that might be the case and tried that myself - didn't work for me, Quest still ignored property <obj; prefix= > later on.
Al (MaDbRiT)
I think Quest is seeing the empty property as not existing, so it reverts to using the tag. The simple workaround for this is not to use the prefix tag when setting up your object, but instead to put
property <prefix=a>
in your object definition.
I suspected that might be the case and tried that myself - didn't work for me, Quest still ignored property <obj; prefix= > later on.
Al (MaDbRiT)
Anonymous
27 Jan 2004, 14:08by ignored I mean it seemed to work in the property viewer, but didn't work in the room description - sorry that was a bit of a bad choice of words!
Al (MaDbRiT)
Al (MaDbRiT)
I think Im Dead
27 Jan 2004, 17:08yeah it can be done for multiple players, it's a complex ordeal as it is but is harder to figure out with multiple players.I haven't yet done it, just thought about it. I'm certain it can be done though.
Eh, as I'm a fan of object/player properties I'll explain how it would work in a multiplayer context. Each player would be given an invisible object in their inventory(well it could be anywhere but why not) called 'playername.known' where of course playername is the name. Each player(if you wanted players to have to introduce themselves or something) or npc would have a property 'name' containing their name, and a property 'unknown.desc' Then I'd have a custom look command that went something like...
command <look> {
for each object in <#quest.currentroom[userid]#> {
if property <player.known; #quest.thing#> then {
inc <look.pcount>
set string <character.%look.pcount%; $objectproperty(#quest.thing#; name)$>
}
}
Then the hard part of the look command would be to reformat the #quest.formatobjects[userid]# string to replace the names.
To reveal the name you'd have to have a different script for players and npc's. Something like if a player speaks in a room, everyone who is there learns their name(or just a generic introduce script), and npc's a similar script when spoken to or something.
I guess you could make a function like $replace(#this#; #withthis#)$ to automatically replace one string with another in and save the output as some other string variable and msg it. I'd work on it all, but I'm a bit busy with a new batlle engine as the previous one is so messy and old it's ridiculous. Hope that gave you some idea.
Eh, as I'm a fan of object/player properties I'll explain how it would work in a multiplayer context. Each player would be given an invisible object in their inventory(well it could be anywhere but why not) called 'playername.known' where of course playername is the name. Each player(if you wanted players to have to introduce themselves or something) or npc would have a property 'name' containing their name, and a property 'unknown.desc' Then I'd have a custom look command that went something like...
command <look> {
for each object in <#quest.currentroom[userid]#> {
if property <player.known; #quest.thing#> then {
inc <look.pcount>
set string <character.%look.pcount%; $objectproperty(#quest.thing#; name)$>
}
}
Then the hard part of the look command would be to reformat the #quest.formatobjects[userid]# string to replace the names.
To reveal the name you'd have to have a different script for players and npc's. Something like if a player speaks in a room, everyone who is there learns their name(or just a generic introduce script), and npc's a similar script when spoken to or something.
I guess you could make a function like $replace(#this#; #withthis#)$ to automatically replace one string with another in and save the output as some other string variable and msg it. I'd work on it all, but I'm a bit busy with a new batlle engine as the previous one is so messy and old it's ridiculous. Hope that gave you some idea.
bds1313
27 Jan 2004, 17:24It did. I'll play around with it and see what I come up with. I've just started to program so I'm learning as I go. I'm picking up stuff quick though ... so hopefully I'll be able to accomplish it. Thanks again for the help.
Big J Money
27 Jan 2004, 18:15It seems to me to be more useful to name an alias with whatever prefix you desire, and ignore the prefix field altogether. This is why: when I reference an #object# with a script like 'msg <you eat #object#>' it doesn't include the prefix anyway! Is there a way you can include a prefix with an #object# string variable? Or, is the prefix only useful when looking at a room and it's objects?
You might say I have to need to call a prefix, but when I use types, it would really come in handy (like my food type with the 'being eaten action').
Thanks in advance,
You might say I have to need to call a prefix, but when I use types, it would really come in handy (like my food type with the 'being eaten action').
Thanks in advance,