list add (car.displayverbs, "Slash tires")Error running script: Cannot modify the contents of this list as it is defined by an inherited type. Clone it before attempting to modify.
suzums wrote:I came across another problem though. Using IsRegexMatch on a string list causes Quest 5.4 beta to crash.
<displayverbs type="list">verb1;verb2;etc</displayverbs>
<inventoryverbs type="list">verb1;verb2;etc</inventoryverbs><displayverbs type="listextend">verb1;verb2;etc</displayverbs>
<inventoryverbs type="listextend">verb1;verb2;etc</inventoryverbs><create_slash_tires_verb type="script">
if (game.pov.boolean_attribute = true) {
game.pov.displayverbs = split ("slash_tires","")
}
</create_slash_tires_verb>jaynabonne wrote:With respect to the cloning problem, when you have inherited types, the list or dictionary is the shared type attribute. It is effectively read-only. In order to modify it, you need to create a modifiable list in the object itself. There is a trick for this.
When you assign a list or dictionary to an object, Quest will make a copy of that list or dictionary. (That has caused me the occasional frustration when I forgot!) So to "clone" the list, as odd as it seems, just do this:
car.displayverbs = car.displayverbs
That will assign the current list attribute to a clone/copy of itself, making it modifiable.