command <take all> for each object in <#quest.currentroom#> give <#quest.thing#>
if not property <#quest.thing#; invisible> then .... (take the object)
I think Im Dead wrote:In QDK you would simply create a new command, call it TAKE ALL, then press the edit button. After that you basically read that script of code, and select from the menu the option that seems most like the code.
For this one you would...
add a FOR EACH OBJECT IN with the string #quest.currentroom#
then press the edit script button
add a conditional, in the IF section select if the object does NOT have a property(you check a little box for not), then the object is #quest.thing#, the property is invisible,
then you specify the THEN script, which would be, give #quest.thing#.
Basically as simple as it reads in the code, just stepped it out for the QDK users. You can basically do this exact same thing with any code pasted here, just gotta read, then pick the right options and enter the right information.
command <take all> {
for each object in <#quest.currentroom#> {
if property <#quest.thing#; WHATEVERYOUWANT> then {
give <#quest.thing#>
}
}
}
command <take all> {
for each object in <#quest.currentroom#> if property <#quest.thing#; WHATEVERYOUWANT> then give <#quest.thing#>
}
Question: How does your version of GET ALL / DROP ALL handle it if the object has a script that fires when the object is taken or dropped?
pseudo-code:
for each object in the room
execute "get obj"
next(Also, Quest's concept of invisibility doesn't make sense to me. If you don't want the object to be listed in the room, or for the player to be able to refer to it, why even put the object in the room in the first place?)
> get all
You take it.
You take it.
You take them.
You can't take it - it's attached to the wall.
You take it.
is there a way to set a 'property' to certain objects that could separate the objects you can take and the ones you can't with the 'take all objects in current room ' command?
command <get all> {
for each object in <#quest.currentroom#> {
if property <#quest.thing#; item> and not hidden <#quest.thing#> then {
exec <get #quest.thing#>
}
}
}define object <couch>
...
end define
define object <apple>
properties <item>
...
end definedefine type <item>
action <OnGet> {
set string <this; $thisobject$>
if property <game; noPronoun> then msg <You take the #@this#.> else msg <You take #(this):article#.>
give <$thisobject$>
}
action <OnDrop> {
set string <this; $thisobject$>
if property <game; noPronoun> then msg <You drop the #@this#.> else msg <You drop #(this):article#.>
lose <$thisobject$>
}
end definedefine object <apple>
type <item>
...
end definecommand <get all> {
'put the noPronoun property on the game object
property <game; noPronoun>
'cycle through the items
set numeric <i; 0>
for each object in <#quest.currentroom#> {
if type <#quest.thing#; item> then {
exec <get #quest.thing#>
inc <i>
}
}
if (%i% = 0) then msg <There is nothing to take here.>
'remove the noPronoun property from the game object
property <game; not noPronoun>
}
command <drop all> {
'put the noPronoun property on the game object
property <game; noPronoun>
'cycle through the items
set numeric <i; 0>
for each object in <inventory> {
exec <drop #quest.thing#>
inc <i>
}
if (%i% = 0) then msg <You have nothing to drop.>
'remove the noPronoun property from the game object
property <game; not noPronoun>
}command <get #@item#> {
if not got <#item#> then {
if action <#item#; OnGet> then doaction <#item#; OnGet> else msg <You cannot take that.>
}
else {
msg <You already have that.>
}
}
command <drop #@item#> {
if got <#item#> then {
if action <#item#; OnDrop> then doaction <#item#; OnDrop> else msg <You cannot drop that.>
}
else {
msg <You don't have that to drop.>
}
}quest.objects
Returns a list of objects in the current room.
ERROR: No such object 'your list of objects here' in condition 'property <your list of objects here; invisible>' ...
ERROR: No such object 'your list of objects here' in condition 'property <your list of objects here; hidden>' ...
etc.
-however how do you code for or express the script for stating a message like 'You aren't carrying anything.'if you try and use the drop all command without carrying anything.
as i spent time on it - and for my ego's sake i'll add what i did - as i was impressed with my own coding efforts (i am no programmer!!)
is there any luck with how do you code for or express the script for stating a that the inventory is empty - i saw "i" on some script a page or so back - is that it?