Will I have to make an object type for each item?

I've recently been working with Java recently and I am aware it's nothing like JavaScript but I'm wondering the best way to implement something like this:
Basically, I want all apples to restore 7 HP but let's say later on I want to change that 10 HP but I don't want to have to manually change every single apple.
I know there are object types and I wondering if this best option.
If you're still confused as to what I mean basically how can I have multiple objects that are the same thing where as I only have to edit 1 thing to edit them all.
Sorry if the solution is simple but I'm still getting back to Quest.

an Object Type (quest's 'classes', at least at the user level) is certainly one way. Another way, is to simply use an Attribute (a global variable), though I'm not aware if quest has any form of a constant variable (a locked~protected variable) like you find in (probably) many programming languages), but this isn't really a concern too much with quest. You could use scripting (such as a function) too. I don't know if there other methods though, I can't think of any other ways to generate universality.

I'd "cheat"!

I would just give object 'Apple 7' the alias apple and object 'Apple 10' the alias Apple. Then, when the time is right, swap out all Apple 7s with your Apple 10s!

That way they all look like apples! Lol

I wonder if I can use JavaScript to create the objects and somehow import them into Quest

Why not just use Quest?

if you want to create Objects (optionally: with Attributes too) and~or set~assign Attributes to Objects, via in-game-scripting:

http://docs.textadventures.co.uk/quest/ ... reate.html
(as the link says, you can give the created Object, an Object Type)

you can then as well assign~set Attributes to that Object, via:

http://docs.textadventures.co.uk/quest/scripts/set.html

if you want to activate a Script Attribute, there's:

http://docs.textadventures.co.uk/quest/scripts/do.html
~ and/or ~
http://docs.textadventures.co.uk/quest/ ... nvoke.html

lastly, you can do this for creating multiple Objects (optionally: with Attributes too) and~or just setting~assigning Attributes to Objects, via:

http://docs.textadventures.co.uk/quest/scripts/for.html
~ and/or ~
http://docs.textadventures.co.uk/quest/ ... reach.html

I think I'll stick with using Object Types that way I can keep track of what's in each room or location rather than have to remember...

If you want to be able to change object attributes en masse, then types won't work for you. A type gives an object its initial definition, but there is nothing in the Quest world model that allows you to actually manipulate types at runtime. So you can't modify the value a type has - there is no way to get a handle on it!

What I have done in the past is to define a class *object* for each type. Then have the higher level objects point to that object. If I want (say) the points restored by an object, I would use:

someObject.class.restorePoints

instead of

someObject.restorePoints

The class attribute would point to *another* object that holds the common values. That way, later you can change the common value simply by updating that class object's attribute. It's a form of delegation.

I hope that makes some sense. If not, I can show a more concrete example.

lightwriter wrote:I've recently been working with Java recently and I am aware it's nothing like JavaScript but I'm wondering the best way to implement something like this:
Basically, I want all apples to restore 7 HP but let's say later on I want to change that 10 HP but I don't want to have to manually change every single apple.
I know there are object types and I wondering if this best option.
If you're still confused as to what I mean basically how can I have multiple objects that are the same thing where as I only have to edit 1 thing to edit them all.
Sorry if the solution is simple but I'm still getting back to Quest.

Types is the way to go if you will be changing it in the editor. If the change will happen during the course of playing the game, go with Jay's suggest.

I see now, I think I got it wrong. It does say "edit" in the question. :)