Heya, Im sure all if you here remember me and my stupid questions >:P
K, right now Im experementing with the click() proc, and Ive run into something I cant solve.
Im trying to make it so I can equip/unequip a wep simply by clicking on it in my inventory , unfortunatly, I cant set it so it only works if you click in the inventory window.
I have it set up right now so the click proc is tied to the obj , Im assuming its something you put into the parentheses that does it...
The way its happening now, is even if your clicking on one thats -not- in your inven, but on the ground, even on the other side if your view, it still equips it..
Please help ^^;
Elorien, hypern00b
ID:150631
Aug 18 2001, 1:04 pm
|
|
Elorien wrote:
Heya, Im sure all if you here remember me and my stupid questions >:P You'd do it kinda like this: client Click(A, windo) if(windo == "Inventory") // Your stuff That will make it only do something if you're clicking in your "Inventory" stat panel. That's because the arguments to Click are the object that was clicked ("A" in this case) and the statpanel that it was in when clicked ("windo" in this case). |
In response to Cinnom
|
|
Cinnom wrote:
Elorien wrote: See, the thing is, Im gonna want the click proc to react differently to different items in the inventory window, so I wanna keep it tied to the OBJ.. So I want it to come out something like this obj/Dagger Click() if(wepequip = "Dagger") wepequip = "" usr << "You unequip a Dagger" else if (wepequip != "") wepequip = "Dagger" usr << "You equip a Dagger" else usr << "You already have something equiped" ..() basicaly along those lines @.@ its proving to be a bit of a challenge tho.. *L* Elorien, hypern00b |
In response to Shadowdarke
|
|
Whohooo!!
That did it *bounce* Thanks a lot ShadowDarke!! ^___^ Elorien, the slowly becoming-not-hypern00b |
In response to Elorien
|
|
Elorien wrote:
See, the thing is, Im gonna want the click proc to react differently to different items in the inventory window, so I wanna keep it tied to the OBJ.. Well, it was basically your job to fill in the rest, but here's an example: client/Click(obj, windo) if(windo == "Inventory") if(obj.name == "Dagger") // Do your stuff for equipping it. if(obj.name == "Apple") src << "You ate the apple." del(obj) |
Click() has an argument that will tell you the location or statpanel where you click the object. Read it's entry in the reference for more details.
obj/Click(Loc)
if(Loc == "Inventory") // assuming your intentory panel is named "Inventory"
// do your thing here
With an else statement, you could make click perform different actions depending on where the item is when you click it.