ID:165446
![]() Dec 23 2006, 7:06 am
|
|
I know you can use mouse procs for statpanels and I'm wondering how to make it so when you double click an item in the stat panel.
|
Yes. if(!src in usr) return will stop the procedure if the clicked object isn't in the player (in his inventory, contents var).
You can also use DblClick()'s argument to see EXACTLY in which statpanel the object was clicked (look it up for more info). |
Liar, it'll not work the way you want it to because what you are saying is if(0 in usr).. the in takes a lesser priority, I recall... you meant if(!(src in usr))... than again, it has been a VERY long time since I used something like that so I don't know if the priority changed :/
- GhostAnime Knowledge is a danger! |
GhostAnime wrote:
Liar, it'll not work the way you want it to because what you are saying is if(0 in usr).. the in takes a lesser priority, I recall... you meant if(!(src in usr))... than again, it has been a VERY long time since I used something like that so I don't know if the priority changed :/ I believe that they both work. Yet they produce an error when i try to use the if. obj/weapons And the proc i am calling looks like this. mob I don't see a problem with the proc and it's only producing error in the if statement. error: proc definition not allowed inside another proc |
Jp wrote:
Ditch the brackets after 'sword'. They're making the compiler think 'sword' is a procedure. Ok, After that it seems to think this: error:Equip:undefined proc error:Dblclick :undefined proc code again: obj/weapons |
The procedure is 'DblClick()'. Capitalisation is important.
The procedure 'Equip' belongs to mobs. You're calling it by calling 'src.Equip(stuff)' (src is assumed if no source is provided). src is a /obj/sword, which doesn't have equip. usr is, in general, safe in DblClick(), so changing that to usr.Equip(stuffs) will fix that issue. Your equipment system has some problems, though - Rather then storing a text string representing what object the player has equipped, why not store the object itself? proc/Equip(obj/o) And then you'd call it like this (In the DblClick() proc): usr.Equip(src) That way, you always have the objects variables around and know which exact object the player has equipped. |
then you can do w/e you want with it.(you didnt really mention what you wanted to do after the usr dbl clicks the item)
(the Double click is DblClick() I believe)