Scripting help: Using inventory items

Started by Greeble0, Thu 19/06/2008 18:59:05

Previous topic - Next topic

Greeble0

I'm  very new to AGS and scripting altogether I’m just trying to make a little point and click but I’m stuck. I’ve checked the tutorials but I can’t see any answers.
My problem is thus, I can’t find or make a script to use inventory items on the out side world, for example using a key on a door. (yes its a noob question)

Khris

Select the door hotspot/object, then click the lightning bolt icon, then click "use inv on ...", then click the ellipses button. A function will be added to the room script, put the code inside.


(Btw, people, this is starting to become the most posed question of all times, is it really that unclear in the manual? I'm too lazy to go through the tutorial right now, but considering the number of threads about this, maybe there's room for improvement.)

Greeble0

Thanks so much, I've been stuck for so long now I can work on my game with new vigor

Makeout Patrol

Quote from: KhrisMUC on Thu 19/06/2008 19:06:57
Select the door hotspot/object, then click the lightning bolt icon, then click "use inv on ...", then click the ellipses button. A function will be added to the room script, put the code inside.


(Btw, people, this is starting to become the most posed question of all times, is it really that unclear in the manual? I'm too lazy to go through the tutorial right now, but considering the number of threads about this, maybe there's room for improvement.)

And don't forget that you need to put some additional logic inside the added function:

if(player.ActiveInventory == iKeys){
  // door opening script
} else {
  Display("You can't use that on the door.");
}

runwithb

Quote from: KhrisMUC on Thu 19/06/2008 19:06:57
(Btw, people, this is starting to become the most posed question of all times, is it really that unclear in the manual? I'm too lazy to go through the tutorial right now, but considering the number of threads about this, maybe there's room for improvement.)

I actually came searching for the same info after looking through the manual for quite a while.  I'm brand new to any kind of scripting, though, so maybe I just wasn't getting it.  The answer seems pretty obvious, and I feel sort of dim now for not figuring it out already.

Anyway, thanks for the info.

Khris

The section can be found here:

Tutorial -> Starting off -> Tutorial Part 3 - Hotspots and interactions

SMF spam blocked by CleanTalk