Changing an object's alias during gameplay...
steve the gaming guy
14 Jul 2005, 19:58I have researched the Help file and the forum and I cannot find a definite answer to this question. It is probably quite simple.
Let's say the player sees an NPC named "lonely girl". After speaking with the NPC and "introducing" himself/herself, the "lonely girl" is now displayed as "Cindy".
I wasn't sure if it was a function or a property change. If anyone knows, please share your knowledge with a humble game-maker. (clarification: I, the game-maker, am humble. I do not make humble games.
)
Let's say the player sees an NPC named "lonely girl". After speaking with the NPC and "introducing" himself/herself, the "lonely girl" is now displayed as "Cindy".
I wasn't sure if it was a function or a property change. If anyone knows, please share your knowledge with a humble game-maker. (clarification: I, the game-maker, am humble. I do not make humble games.

francisstokes
14 Jul 2005, 20:08You could always have name of the lonely girl as a string variable and change the value later.
MaDbRiT
14 Jul 2005, 20:32Steve
You change an 'alias' by treating it as a property of the object it relates to.
e.g.
property <girl;alias=Cindy>
Here's an example
Al (MaDbRiT)
You change an 'alias' by treating it as a property of the object it relates to.
e.g.
property <girl;alias=Cindy>
Here's an example
' "girl"
' Created with QDK Pro 3.53
define game <girl>
asl-version <350>
gametype singleplayer
start <start>
game author <madbrit>
game info <Created with QDK Pro 3.53>
end define
define synonyms
end define
define room <start>
define object <girl>
alias <lonely girl>
alt <girl; lonely girl; Cindy>
speak {
property <girl; alias=Cindy>
say <Hi, my name's Cindy.>
}
prefix <a >
gender <she>
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end define
Al (MaDbRiT)
paul_one
14 Jul 2005, 23:25Yeah, it is a tiny bit buried in the help file. The whole thing is about actions, properties and types.
But yeah, as Al said, changing the property will change the <tag> that ASL code gives an object.
You can also set actions (using "action <#object#; #actionname#>" ) and they are dominant over properties...
So, for example, you have a property 'alias' = 'Lonely girl' and give the object an action of 'alias' = 'msg <Cindy>'... Then Cindy will come across and not Lonely girl.
Although they aren't actually the same, I think I get my point across.
Francis, if you try it it will fail. String's may change, but the name of the object will not as it's not a REFERENCE. I've tried something similar (placing a variable inside a status variable.... Which works if you refresh it - which I had to do by setting itself to itself - I think I do this in my RPG lib!) and it doesn't work.
But yeah, as Al said, changing the property will change the <tag> that ASL code gives an object.
You can also set actions (using "action <#object#; #actionname#>" ) and they are dominant over properties...
So, for example, you have a property 'alias' = 'Lonely girl' and give the object an action of 'alias' = 'msg <Cindy>'... Then Cindy will come across and not Lonely girl.
Although they aren't actually the same, I think I get my point across.
Francis, if you try it it will fail. String's may change, but the name of the object will not as it's not a REFERENCE. I've tried something similar (placing a variable inside a status variable.... Which works if you refresh it - which I had to do by setting itself to itself - I think I do this in my RPG lib!) and it doesn't work.
steve the gaming guy
15 Jul 2005, 16:00Thanks you guys! You are more than helpful!
Now that I understand what you are doing with the alias bit, I also was able to change the prefix in the same manner. The reason why I did this is if you walk into a room where a girl is at, the Quest room description defaults to show "There is a girl here". If you talk to the girl changing her name to Cindy and then re-enter the room, Quest then says "There is a Cindy here."
If you put another line of code such as "prefix=" and put nothing after the = sign, you then receive the message "There is Cindy here." It's not the best English but it certainly is better than an "a" in front of Cindy.
Now that I understand what you are doing with the alias bit, I also was able to change the prefix in the same manner. The reason why I did this is if you walk into a room where a girl is at, the Quest room description defaults to show "There is a girl here". If you talk to the girl changing her name to Cindy and then re-enter the room, Quest then says "There is a Cindy here."
If you put another line of code such as "prefix=" and put nothing after the = sign, you then receive the message "There is Cindy here." It's not the best English but it certainly is better than an "a" in front of Cindy.
The Stalker
15 Jul 2005, 17:15Why not stick it on the same line in the same command?
property <girl; alias=Cindy; prefix=>
property <girl; alias=Cindy; prefix=>
francisstokes
15 Jul 2005, 17:46I didn't even test it
but i'm getting the feeling now that properties are better for alot of things than variables are.

steve the gaming guy
15 Jul 2005, 18:10The Stalker wrote:Why not stick it on the same line in the same command?
property <girl; alias=Cindy; prefix=>
Because I just learned how to do this and I didn't know it could go on the same line.
paul_one
15 Jul 2005, 19:59I've said that all along.but i'm getting the feeling now that properties are better for alot of things than variables are.
The only exception is status variables - where they can be displayed on-screen by default, and have an "onchange" script that executes whenever the variable is altered. That is very smooth, and saves alot of coding and work-arounds in other places.
Steve, is it a Mrs, Ms, etc? I'm sure that "There is Miss Cindy" would look a bit better still.
Alternatively you could probably change the room's indescription property (is that the right one?) to change the way objects are listed, so it look's 90% the same but just lists "Cindy is here".
Super-alternatively, you could change the DEFAULT description (in global settings somewhere I guess) and have it list objects with a "there is" at the start.
I may do that as I would prefer it just as a list without the "there is".. And if the prefix is all correct (a property I previously hated) then it shouldn't cause an error (the book is here, the old woman is here, a big ladder is here, Cindy is here, John is here, an old lantern is here, etc).
MaDbRiT
15 Jul 2005, 20:08Hi
Just a thought, typelib differentiates between actors and objects in room descriptions by default...
e.g.
You are in the Pub
Jane and the Bartender are here.
Inside an olde worlde pub -- plastic variety
There is a jukebox here.
You might want to check that out
Al (MaDbRiT)
Just a thought, typelib differentiates between actors and objects in room descriptions by default...
e.g.
You are in the Pub
Jane and the Bartender are here.
Inside an olde worlde pub -- plastic variety
There is a jukebox here.
You might want to check that out

Al (MaDbRiT)
I think Im Dead
16 Jul 2005, 14:52Tr0n wrote:I've said that all along.
You used to be a variable abusing little monkey, admit it.
paul_one
16 Jul 2005, 15:05.... OK *breaks down and cries*, IT WAS MEEEE!You used to be a variable abusing little monkey, admit it.
... Yeah, until object properties came along I used ALOT of variables. I started messing with properties and quite soon after was using them ALOT.
I still don't use type's too much, as most of my objects are 'tailor'ed for each purpose, meaning a general 'type' doesn't apply.
But Al's used it quite well, and I understand the power of types too.
steve the gaming guy
18 Jul 2005, 13:31Tr0n, it is a miss and that probably would be good for certain situations.
Al, now that you mention it. I do remember those neat little additions in typelib with actors, etc...
Al, now that you mention it. I do remember those neat little additions in typelib with actors, etc...