Problem with shop

So ok I decide to create a shop, add some said attribute, add some stocking room and test play, when I enter I got heaps of error like this

Error running script: Error evaluating expression '(not GetBoolean(game.pov.parent, "visited")) and HasScript(game.pov.parent, "beforefirstenter")': GetBoolean function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetDirectChildren (game.pov.parent)': GetDirectChildren function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetBoolean(game.pov.parent, "dark")': GetBoolean function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(room)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(room)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetBoolean(room, "transparent")': GetBoolean function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(newParent)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(room)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(room)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetBoolean(room, "transparent")': GetBoolean function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(newParent)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(room)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(room)': GetAllChildObjects function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetBoolean(room, "transparent")': GetBoolean function expected object parameter but was passed 'null'
Error running script: Error evaluating expression 'GetAllChildObjects(newParent)': GetAllChildObjects function expected object parameter but was passed 'null'
also attempt to use buy command, I got the above error.


Somehow the player is nowhere. The player, like all objects, has an attribute, "parent", which is its currently location, and that value is null. Why that happens is hard to say without seeing the code, but look at any part where you are moving the player.


Hi Kevin, like The Pixie said hard to tell whats wrong without the code. But what I can say is if you do something like this below its pretty easy to go from there.

shopmenu = NewStringList()
list add (shopmenu, "weapons")
list add (shopmenu, "tools")
list add (shopmenu, "item")
ShowMenu ("What would you like to buy?", shopmenu, true) {
  msg ("You choose " +result+ ".")
  if (result<>null) {
  }
  else if (result = "weapons") {
    BuyWeapons
  }
  else if (result = "tools") {
    BuyTools
  }
  else if (result = "item") {
    BuyItems
  }
  else {
    msg ("You canceled!")
  }
}

What I did was make a command (You could use a verb on an NPC as well) called it "shop" then added in this script. In the script you see I call a function like 'BuyWeapons' which is a Function I also created containing another menu of available weapons, same goes for tools and items so once clicked on an option it will open up a second menu with the correct things you wish to buy. When you want to buy just check your currency system if you have (>= xamount) then move said item to inventory else you don't have enough to purchase that.

Hope it helps
Mike


quest requires that there be a Player Object within a Room Object, as all of it's underlying code is based upon this requirement:

http://docs.textadventures.co.uk/quest/asl_requirements.html

so, either make sure you've got:

a custom Player Object (set as being a Player object, and having the 'game.pov' being set as this Player Object) within some Room Object (using the GUI/Editor and/or the 'parent' Object Attribute), and/or check any of your game code that might be messing with this too... (we'd need to see your entire game code, if you can't find the cause yourself)

or that your default 'player' Player Object is within a Room Object, and/or check any of your game code that might be messing with this too... (we'd need to see your entire game code, if you can't find the cause yourself)

also, note that there's the 'game.pov' (the pov feature) too, which might have gotten messed up accidentally by you, if you've been working with it or changing some of the code around (it's a simple fix, but again, we'd need to see your entire game code to find the cause): http://docs.textadventures.co.uk/quest/tutorial/changing_the_player_object.html


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums