Bug: Broken Script Command?
Overcat
07 Oct 2009, 20:08I have a master item that I want to clone out to a bunch of different rooms/actors. (Let's say it's a sword, and let's say we're just propogating to the player's inventory. I want to do this for a bunch of different items, but we'll stick to the sword for this explanation.)
I create the master item, and give it a Propogate action.
In my start script, I loop through all the game objects and run the Propogate action for them, if they have it. (Most objects won't need to propogate.)
The Propogate action looks like this:
The action calls a Propogate function, which looks like this:
This function in turn utilizes another function (GetNextClone) to return the next clone name, but it is not relevant to the question at hand. (GetNextClone is included in the downloadable ASL file at the end of this post.) The line I'm having trouble with is this:
Essentially, all I'm attempting to do is overwrite the Propogate action that the cloned object inherits from the master object. I don't want the cloned objects to have the functionality of this action. (One might think, as I initially did, that I am going to cause an infinite loop with the startscript, since I am creating new objects with the Propogate action even as I iterate over the objects that already have it. For some reason, Quest doesn't recognize the newly cloned objects in the startscript.)
In the documentation, regarding the 'action' script command, we have this under Script Commands:
And then we have the following under Changing Objects and Rooms During the Game:
Both of which, to my mind, mean that the aforementioned troublesome line should be replacing the Propogate action of the cloned object with 'msg < Propogate action removed.>'.
This, however, is not occurring. There are two commands in the attached ASL file:
1. "list all #action# objects": replace #action# with 'propogate' (ie. type "list all propogate objects"), and it'll list those objects in the game with the Propogate action. In this case 'sword' and 'sword_1' will appear in the list. 'sword' is the original, master item, whereas 'sword_1' is the cloned item in the player's inventory.
2. "action #object#:#action#": replace #object# with the object name shown by the previous command, and #action# with 'propogate', and it'll fire the propogate action for the object you specified.
For instance, if you type "action sword:propogate", you'll get another sword in your inventory named 'sword_2'. If you type "action sword_1:propogate", you'll get another sword in your inventory named 'sword_1_1'.
But the latter input shouldn't have that effect at all - I have explicitly overwritten the propogate action...
Question: Is the 'action <object; action> (script)' script command broken?
I create the master item, and give it a Propogate action.
In my start script, I loop through all the game objects and run the Propogate action for them, if they have it. (Most objects won't need to propogate.)
The Propogate action looks like this:
action <Propogate> {
set string <this; $thisobject$>
set string <cloned; $Propogate(#this#; inventory)$>
if (#cloned# <> NULL) then property <#cloned#; owner = player>
}
The action calls a Propogate function, which looks like this:
'copies a master item into a new item, and then moves that item to the
'provided location
'parameter1 = the master item to clone
'parameter2 = the location where the item is to be placed
define function <Propogate>
set string <Propogate_return; NULL>
set string <Propogate_p1; $parameter(1)$>
set string <Propogate_p2; $parameter(2)$>
if real <#Propogate_p1#> then {
if real <#Propogate_p2#> then {
set <Propogate_return; $GetNextClone(#Propogate_p1#)$>
clone <#Propogate_p1#; #Propogate_return#; #Propogate_p2#>
action <#Propogate_return#; Propogate> msg < Propogate action removed.>
}
else {
msg <Attempted to propogate base item '#Propogate_p1#' to non-existent location '#Propogate_p2#'.>
}
}
else {
msg <Attempted to propogate non-existent base item '#Propogate_p1#' to location '#Propogate_p2#'.>
}
return <#Propogate_return#>
end define
This function in turn utilizes another function (GetNextClone) to return the next clone name, but it is not relevant to the question at hand. (GetNextClone is included in the downloadable ASL file at the end of this post.) The line I'm having trouble with is this:
action <#Propogate_return#; Propogate> msg < Propogate action removed.>
Essentially, all I'm attempting to do is overwrite the Propogate action that the cloned object inherits from the master object. I don't want the cloned objects to have the functionality of this action. (One might think, as I initially did, that I am going to cause an infinite loop with the startscript, since I am creating new objects with the Propogate action even as I iterate over the objects that already have it. For some reason, Quest doesn't recognize the newly cloned objects in the startscript.)
In the documentation, regarding the 'action' script command, we have this under Script Commands:
action <object name; action name> script
Creates or replaces the specified action script for the specified object.
And then we have the following under Changing Objects and Rooms During the Game:
A tick in the "Action" column means you can set script for the tag using the action command, e.g.
action <lamp; look> picture <lamp.bmp>
If an action is set, that takes priority over an equivalent property.
Both of which, to my mind, mean that the aforementioned troublesome line should be replacing the Propogate action of the cloned object with 'msg < Propogate action removed.>'.
This, however, is not occurring. There are two commands in the attached ASL file:
1. "list all #action# objects": replace #action# with 'propogate' (ie. type "list all propogate objects"), and it'll list those objects in the game with the Propogate action. In this case 'sword' and 'sword_1' will appear in the list. 'sword' is the original, master item, whereas 'sword_1' is the cloned item in the player's inventory.
2. "action #object#:#action#": replace #object# with the object name shown by the previous command, and #action# with 'propogate', and it'll fire the propogate action for the object you specified.
For instance, if you type "action sword:propogate", you'll get another sword in your inventory named 'sword_2'. If you type "action sword_1:propogate", you'll get another sword in your inventory named 'sword_1_1'.
But the latter input shouldn't have that effect at all - I have explicitly overwritten the propogate action...
Question: Is the 'action <object; action> (script)' script command broken?