Back to the Shop ( resolved )

Okay...So I recently had a few troubles getting Pixies Shop to work in my new game. But with the help of the brilliant minds here, I was able to get it working like a charm.
Thinking I had it down as to getting it working...I decided I could use such a shop in my older...more time invested game.
I have been working on my older game offline for over two and a half years now. I recently upgraded to the newest version of Quest. When I started working on this game, Money wasn't even an option for someone like me that only uses the GUI.

Here's the problem...The Shop set up just fine, BUT, when you try to buy an item...it gives this Error:
Error running script: Unrecognised list type

Is there something that changed from the older version, to the newer version that is not recognizing my list types? I set the objects up as simple objects. None of them are wearables or anything else. (I realized that was a problem in the newer game.)

This game is far to large to upload the code...so I hoping someone might know what the possible problem is.
Any thoughts or advice would be greatly appreciated.


I had this error earlier today. I had three list add()-functions adding values to a list. When I tried the ShowMenu function with the list which got created that way, I got the error you mentioned.

Fixed it by declaring the variable first. Like: variablename = NewStringList() - then added the items.

In your case, you'd probably want NewObjectList(). Not sure, though.


you can use the 'Split' Script/Function for quickly creating String Lists:

create ("example_object") // creates an 'example_object' Object

example_object.example_stringlist_attribute = Split ("red;blue;yellow", ";")

or you can use the "normal" way (creating a new/blank/empty stringlist and then adding its items to it):

create ("example_object") // creates an 'example_object' Object

example_object.example_stringlist_attribute = NewStringList ()
list add (example_object.example_stringlist_attribute, "red")
list add (example_object.example_stringlist_attribute, "blue")
list add (example_object.example_stringlist_attribute, "yellow")


however, for Object Lists, you CAN ONLY (MUST) use the "normal" way, you can NOT use the 'Split' for creating Object Lists:

create ("example_object") // creates an 'example_object' Object

create ("red") // this creates a 'red' Object
create ("blue") // this creates a 'blue' Object
create ("yellow") // this creates a 'yellow' Object

example_object.example_objectlist_attribute = NewObjectList ()
list add (example_object.example_objectlist_attribute, red)
list add (example_object.example_objectlist_attribute, blue)
list add (example_object.example_objectlist_attribute, yellow)


pay attention to whether you use the double quotes for its Value or not, depending on whether its a String List or an Object List


@ RobBronson:

if it's not a Data Type syntax issue (or the stringlist or the Object_Type / Type / Inherited_Attribute is missing/not-created, then someone knowledgeable of Pixie's library will have to help you, as I've not studied (don't know) most of Pixie's (many) libraries, not yet... eventually I will... eventually... lol


If the error comes up when you try to buy an object, it's likely because it's trying to modify the object's verbs list when it doesn't exist. When you buy an object, it removes "buy" from that object's display verbs list … but it doesn't check that "Buy" was on the verbs list in the first place.

I'd suggest changing:

      list remove (obj.generatedverbslist, "Buy")
      list remove (obj.displayverbs, "Buy")
      list remove (obj.inventoryverbs, "Buy")

(in BuyObject function)
to:

      foreach (verblist, Split("displayverbs;inventoryverbs;generatedverbslist")) {
        if (HasAttribute (obj, verblist)) {
          verbs = GetAttribute (obj, verblist)
          if (ListContains (verbs, "Buy")) {
            list remove (verbs, "Buy")
          }
        }
      }

That way it will work correctly even if you have "automatically generate verbs" turned off.


So from what I have read here...the easiest fix would be to try and enable the "automatically generate verbs" function.
Turning that on worked...as far as the fact that it says I bought it...yet 6 new errors follow with it.

You buy it for $2.
Error running script: Error evaluating expression 'GetAllChildObjects(game.pov)': Collection was modified; enumeration operation may not execute.
Error running script: Error evaluating expression 'ListCombine(ScopeReachableNotHeldForRoom(room), ScopeReachableInventory())': Value cannot be null.Parameter name: collection
Error running script: Unrecognised list type
Error running script: Error evaluating expression 'ListCombine(ScopeReachableNotHeldForRoom(room), ScopeVisibleNotReachableForRoom(room))': Value cannot be null.Parameter name: collection
Error running script: Cannot foreach over '' as it is not a list
Error running script: Error evaluating expression 'ListExclude(ScopeVisibleNotHeldNotScenery(), game.pov)': Object reference not set to an instance of an object.

I will keep working on trying some of the things suggested.


So the BuyObject function is already set as...

if (obj.price > game.pov.money) {
  msg ("You can't afford that!")
}
else {
  if (GetBoolean(obj, "cloneme")) {
    obj = CloneObject(obj)
  }
  obj.take = true
  obj.parent = game.pov
  obj.buy = null
  obj.listalias = obj.alias
  list remove (obj.generatedverbslist, "Buy")
  list remove (obj.displayverbs, "Buy")
  list remove (obj.inventoryverbs, "Buy")
  game.pov.money = game.pov.money - BuyingPrice(obj)
  msg ("You buy " + obj.article + " for " + DisplayMoney(BuyingPrice(obj)) + ".")
}

So you are saying I should replace that 3 line list remove section...with this code?

  foreach (verblist, Split("displayverbs;inventoryverbs;generatedverbslist")) {
        if (HasAttribute (obj, verblist)) {
          verbs = GetAttribute (obj, verblist)
          if (ListContains (verbs, "Buy")) {
            list remove (verbs, "Buy")
          }
        }
      }

Do you think that will stop all the new errors as well?
I'll try it if you think it will.


Holy Crap MrAngel...That actually worked perfectly!
Was able to buy the items with no errors.
Thank you so much. :)


I appreciate the help in fixing this problem...I have to wonder if there is a fix so that you might sell edibles and wearables?
If I add those items they never seem to work. Is there some special code for those types of objects?

If not...it is no big deal. I am just truly happy to have a shop working now :)
THANKS AGAIN !

Nevermind...this new code apparently fixes that too! I love it :)


Log in to post a reply.

Support

Forums