Move all Inventory AT ONCE
metalmario991
06 Dec 2015, 23:02At one point in my game I want to have it so all your inventory is taken (temporairly) for a section and you get it from a container later. What I can do to make every item currently in your invetory move to the container?

XanMag
06 Dec 2015, 23:32Compliments of The Pixie.
I believe you will only need this part though?
And you should replace 'somewhereelse' with a room that you want to move them too. Someone correct me if that is wrong please.
foreach(obj, ScopeInventory()) {
if (not obj = firstobjecttokeep and not obj = secondobjecttokeep) {
obj.parent = somewhereelse
}
}
I believe you will only need this part though?
foreach(obj, ScopeInventory()) {
obj.parent = somewhereelse
}
}
And you should replace 'somewhereelse' with a room that you want to move them too. Someone correct me if that is wrong please.
HegemonKhan
07 Dec 2015, 00:05also, note the difference from the game objects actual "physical" location~containment vs the Object's names stored in an Object List (such as the 'ScopeInventory' Objectlist).
the game objects initial location is the 'player' Player Object, but to manipulate them (such as moving them), you're using the 'ScopeInventory' Objectlist + 'foreach' Function (to iterate through all of them) to move them to another location, for example: 'data_storage_room' Room Object
so, now that you got your game objects "physically" located~contained (in~inside) the 'data_storage_room' Room Object, how would you then say move them back to the 'player' Player Object as their actual "physical" location?
answer: you can't (well unless you do them script individually via: objectX.parent = player), UNLESS you add those game objects' names to an Objectlist Attribute first and then use a 'foreach' Function on it!
aka: you can't iterate (cycle through) an Object Element, but you can iterate through an Objectlist (and the other List type, Stringlist, too, of course)
the game objects initial location is the 'player' Player Object, but to manipulate them (such as moving them), you're using the 'ScopeInventory' Objectlist + 'foreach' Function (to iterate through all of them) to move them to another location, for example: 'data_storage_room' Room Object
so, now that you got your game objects "physically" located~contained (in~inside) the 'data_storage_room' Room Object, how would you then say move them back to the 'player' Player Object as their actual "physical" location?
answer: you can't (well unless you do them script individually via: objectX.parent = player), UNLESS you add those game objects' names to an Objectlist Attribute first and then use a 'foreach' Function on it!
aka: you can't iterate (cycle through) an Object Element, but you can iterate through an Objectlist (and the other List type, Stringlist, too, of course)
metalmario991
07 Dec 2015, 00:45Okay, so since I am not that sauvy with how Quest works, I might need more of an explanation but anyway,
I entered this and got this error:
Error running script: Error compiling expression 'obj': Unknown object or variable 'obj'
So what am I doing wrong?
Also what, is the loop variable suppose to be?
(Also attaching a picture of what I have)
I entered this and got this error:
Error running script: Error compiling expression 'obj': Unknown object or variable 'obj'
So what am I doing wrong?
Also what, is the loop variable suppose to be?
(Also attaching a picture of what I have)

HegemonKhan
07 Dec 2015, 01:01for this:
For each loop variable _______________ in source [the inventory]
type in this:
obj
so, it should look like this:
For each loop variable obj in source [the inventory]
(my underlining is just to represent the empty text box that you need to type 'obj' into)
-----------------
explanation of the 'foreach' loop:
let's say we've got an Objectlist (named: myobjectlist), with the items (as Objects' names): ball, toy, hat
foreach (x, myobjectlist)
(hidden from you, the foreach sets each of the items in the list to the 'x' :
x = ball
x = toy
x = hat
then you got a (move~parent) Script (using your example):
x.parent = LaundryHamper
so, what happens is the script acts upon each item (through the 'x' temporary-placeholder variable):
(x <==== ball) ====> x.parent =====> ball.parent = LaundryHamper
(x <==== toy) ====> x.parent =====> toy.parent = LaundryHamper
(x <==== ball) ====> x.parent =====> ball.parent = LaundryHamper
notice how I used 'x' instead of 'obj', this is because the temporary-placeholder variable's name doesn't matter.
--------------
the 'parent' Object Attribute is (for the most part) the *SAME* as the GUI~Editor's 'MoveObject(moving_object, destination_object)' Script
player.parent = room
is the same as
MoveObject (player, room)
aka: the 'player' Player Object is being set (or re-set) inside-of-(or: to) the 'room' Room Object
------
understanding the concept of a 'parent-child' heirarchy, understanding of 'parent' concept:
HK.parent = earth
LittleGreenAlienWithABigHead.parent = mars // for example only, lol
UnitedStates.parent = NorthAmerica
London.parent = UnitedKingom
UnitedKingdom.parent = Europe
HK
-> pants
->-> wallet
->->-> $1
->->-> $5
HK is the main (root) parent
HK is the direct parent of pants
HK is the indirect parent of wallet, $1, and $5
pants is the direct child of HK
pants is the direct parent pf wallet
pants is the indirect parent of $1 and %5
wallet is the indirect child of HK
wallet is the direct child of pants
wallet is the direct parent of $1 and %5
$1 is the indirect child of HK
$1 is the indirect child of pants
$1 is the direct child of wallet
$5 is the indirect child of HK
$5 is the indirect child of pants
$5 is the direct child of wallet
pants.parent = HK
wallet.parent = pants
OneDollar.parent = wallet
FiveDollars.parent = wallet
(windows 7 storage heirarchy)
C:\ (a drive)
-> Programs (a folder)
->-> Quest 5 (a folder)
->->-> quest.exe (a file)
Sun
-> Earth
->-> North America
->->-> United States
->->->-> California
Earth.parent = Sun
NorthAmerica.parent = Earth
UnitedStates.parent = NorthAmerica
California.parent = UnitedStates
For each loop variable _______________ in source [the inventory]
type in this:
obj
so, it should look like this:
For each loop variable obj in source [the inventory]
(my underlining is just to represent the empty text box that you need to type 'obj' into)
-----------------
explanation of the 'foreach' loop:
let's say we've got an Objectlist (named: myobjectlist), with the items (as Objects' names): ball, toy, hat
foreach (x, myobjectlist)
(hidden from you, the foreach sets each of the items in the list to the 'x' :
x = ball
x = toy
x = hat
then you got a (move~parent) Script (using your example):
x.parent = LaundryHamper
so, what happens is the script acts upon each item (through the 'x' temporary-placeholder variable):
(x <==== ball) ====> x.parent =====> ball.parent = LaundryHamper
(x <==== toy) ====> x.parent =====> toy.parent = LaundryHamper
(x <==== ball) ====> x.parent =====> ball.parent = LaundryHamper
notice how I used 'x' instead of 'obj', this is because the temporary-placeholder variable's name doesn't matter.
--------------
the 'parent' Object Attribute is (for the most part) the *SAME* as the GUI~Editor's 'MoveObject(moving_object, destination_object)' Script
player.parent = room
is the same as
MoveObject (player, room)
aka: the 'player' Player Object is being set (or re-set) inside-of-(or: to) the 'room' Room Object
------
understanding the concept of a 'parent-child' heirarchy, understanding of 'parent' concept:
HK.parent = earth
LittleGreenAlienWithABigHead.parent = mars // for example only, lol
UnitedStates.parent = NorthAmerica
London.parent = UnitedKingom
UnitedKingdom.parent = Europe
HK
-> pants
->-> wallet
->->-> $1
->->-> $5
HK is the main (root) parent
HK is the direct parent of pants
HK is the indirect parent of wallet, $1, and $5
pants is the direct child of HK
pants is the direct parent pf wallet
pants is the indirect parent of $1 and %5
wallet is the indirect child of HK
wallet is the direct child of pants
wallet is the direct parent of $1 and %5
$1 is the indirect child of HK
$1 is the indirect child of pants
$1 is the direct child of wallet
$5 is the indirect child of HK
$5 is the indirect child of pants
$5 is the direct child of wallet
pants.parent = HK
wallet.parent = pants
OneDollar.parent = wallet
FiveDollars.parent = wallet
(windows 7 storage heirarchy)
C:\ (a drive)
-> Programs (a folder)
->-> Quest 5 (a folder)
->->-> quest.exe (a file)
Sun
-> Earth
->-> North America
->->-> United States
->->->-> California
Earth.parent = Sun
NorthAmerica.parent = Earth
UnitedStates.parent = NorthAmerica
California.parent = UnitedStates

XanMag
07 Dec 2015, 01:57Here is what the GUI looks like for it. I've double checked. This works.

In my game, everything disappears except for the anklet and the man card.

In my game, everything disappears except for the anklet and the man card.