here's some resources, might as well provides these for you now, lol:
Libraries Forum Board:
viewforum.php?f=18(maybe more) Library Downloads Page:
http://quest5.net/wiki/Librariesthink of libraries as like "patches" (or even entire game engine-core code) of code that you can put into to your game, to add and~or change your game.
here's a particular library for your OP question:
viewtopic.php?f=18&t=3515extremely useful links:
http://quest5.net/wiki/Category:All_Fun ... t_Commands (1st page ~ A to S)
http://quest5.net/w/index.php?title=Cat ... h#mw-pages (2nd page ~ S to Z)
http://quest5.net/wiki/Main_Pagehttp://quest5.net/wiki/Tutorialhttp://quest5.net/wiki/How_toenjoy!

-------------------------------------------------------------------
While Sora's Library deals with your major questions, it might not be exactly easy to transfer it over to what you want, so for a much more simple response to your OP, echoing much of what the above poster has already said:
as far as I know, there's only two ways to deal with having many objects (without the clutter or most other isues~hassles):
actual~real physical objects: cloning
(
http://quest5.net/wiki/Category:All_Fun ... t_Commands ~ Clone, CloneObject, CloneObjectAndMove)
fake objects: an integer (or double) attribute
one good example scenario of such an issue, is what to do for making a "quiver~case holding many arrows and their depletion upon firing them in your bow"
obvious, you don't want any more objects than you need (as any game will already have tons and tons of vital needed objects).
the easy answer is the integer attribute: quiver.count=50, and then just adjust that integer as needed, there's either no arrow object or only one (or a few) arrow object(s) that aren't ever actually fired~used or nor moved.
Another example, is how to deal with a shop of items~equipment~etc and their buying~selling while keeping the shop in stock.
The player needs to be able to buy (and have, take) the item~equipment, but you want the shop to still have that item~equipment in stock to be bought again, should the player need to do so (or in the case of items, like with potions, the player will want to be able to buy many of them). the best answer to this is to use clones (though there's a few issues with them), and again attributes too as well.
--------------------------
1. Flashlight batteries depleting over time when the flashlight is on.let me introduce you to the "TURNSCRIPT" (at the top of the GUI~Editor, click on the "Add" in the horiz. bar menu at the top)
a turnscript is an ALWAYS ACTIVE~RUNNING function~script (which can be global~entire~game or for specific rooms only, just place it where you want it to be running to run that way, lol), so this is extremely useful!
now we need a game_action_counter, a "turn" integer attribute...
so, in the GUI~Editor:
Game -> Attributes (TAB) -> Add Attribute ->
Name: global_turns
Type: int (integer)
Value: 0
(if you want this to be displayed on the right pane during game play, then also create~add a status attribute, named as the same, "turn", and leave the 2nd question window that comes up blank when you create~add the status attribute, whatever it is called, lol)
now we create the turnscript, make sure it is global (when you add it from the top bar menu, have the root ~ the top left most "Object" on the left pane's "tree of stuff" be highlighted, and not a specific room):
in code:
<turnscript name="global_events_or_turns_turnscript">
game.global_turns = game.global_turns + 1
</turnscript>
this will cause everytime you do something in the game, to then afterwards increase our "turns" by one.
now we add what we want to this turnscript, such as your request:
(you also of course have to create~add the attributes onto the actual object too)
<turnscript name="global_events_or_turns_turnscript">
flashlight_batteries_power_count = flashlight_batteries_power_count - 1
game.global_turns = game.global_turns + 1
</turnscript>
so, each "turn" you'll now lose one flashlight_battery: turn 0 = 5 batteries -> turn 1 = 4 batteries -> etc...
but now we need your requested conditionals too:
<turnscript name="global_events_or_turns_turnscript">
if (HasAttribute ("flashlight, "strong") = true {
if (HasAttribute (flashlight, "switchable") = true) {
if (flashlight.switchedon=true) {
if (flashlight_batteries_power_count > 0) {
flashlight_batteries_power_count = flashlight_batteries_power_count - 1
} else {
flashlight.switchedon=false // this turns off the flashlight
flashlight.switchable=false // this makes it so that you can't just turn right back on the flashlight, lol
}
}
} else (if (HasAttribute (flashlight, "switchable") = false) {
if (flashlight_batteries_power_count > 0) {
flashlight.switchable=true // this makes the flashlight able to be turned on again, but you'll still have to actually turn on the flashlight to turn it on still, lol
}
}
}
game.global_turns = game.global_turns + 1
</turnscript>
now, this is getting a little messy already, so let's put the entire flashlight script block into~as a function, and then we'll call that function with our turnscript:
<function name="flashlight_batteries_power_count_function">
if (HasAttribute ("flashlight, "strong") = true {
if (HasAttribute (flashlight, "switchable") = true) {
if (flashlight.switchedon=true) {
if (flashlight_batteries_power_count > 0) {
flashlight_batteries_power_count = flashlight_batteries_power_count - 1
} else {
flashlight.switchedon=false // this turns off the flashlight
flashlight.switchable=false // this makes it so that you can't just turn right back on the flashlight, lol
}
}
} else (if (HasAttribute (flashlight, "switchable") = false) {
if (flashlight_batteries_power_count > 0) {
flashlight.switchable=true // this makes the flashlight able to be turned on again, but you'll still have to actually turn on the flashlight to turn it on still, lol
}
}
}
</function>
<turnscript name="global_events_or_turns_turnscript">
flashlight_batteries_power_count_function // the name of the function calls (activates) the function
game.global_turns = game.global_turns + 1
</turnscript>
2. The ability to make an object directly effect the attributes of another, then destroy themselves.This is no longer relevant for what you requested based on my method, but here's how to do this stuff, if you want to (such as for other things or uses):
here's how to remove and destroy:
http://quest5.net/wiki/RemoveObjecthttp://quest5.net/wiki/RemoveSceneryObjectshttp://quest5.net/wiki/DestroyBut, as said by the above poster, it is better to MOVE stuff to a hidden "dump" object:
this is done by creating~adding an object which is NOT a child of any room object, this is called a "Data Object".
for example:
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="global_events_data_object">
<score type="int">0</score>
<dragon_killed type="boolean">false</dragon_killed>
<race_list type="simplestringlist">human;dwarf;elf;gnome;hobbit;orc</race_list>
(etc etc etc ANY stuff)
</object>
</asl>
the benefit of this is that I've got a permanent object, which is hidden (unknown) to the game player~user during game play, which I~you (the game maker) can use to attach attributes onto, and then use them in the game. your own "data storage".
so, as an example, I can use the above data object to do this:
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<start type="script">
character_creation_function
</script>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="global_events_data_object">
<score type="int">0</score>
<dragon_killed type="boolean">false</dragon_killed>
<race_list type="simplestringlist">human;dwarf;elf;gnome;hobbit;orc</race_list>
(etc etc etc ANY stuff)
</object>
<function name="character_creation_function">
show menu ("What is your race?", global_events_data_object.race_list, false) {
player.race=result
}
</function>
</asl>
and as for objects affecting other objects' attributes, that just uses attributes and conditionals in your scriptings
an example:
<object name="healing_potion">
<verb name="drink">
<script><![CDATA[
if (player.healing_potion_count > 0) {
player.hp = player.hp + 50
player.healing_potion_count = player.healing_potion_count - 1
} else {
msg ("You don't have any more healing potions.")
}
]]><script>
</verb>
</object>