ID:144892
 
Code:
obj
clothes


verb

wear()
if(!src.worn)
src.layer=worn_layer
add_overlay(src)
src.worn=1
suffix="(worn)"
else
return

remove()
if(src.worn)
src.layer=normal_layer
remove_overlay(src)
src.worn=null
suffix=null
else
return

layer=normal_layer

goku_hair
name="Goku Wig"
icon='goku_hair.dmi'





hat
name="red hat"
icon = 'hat.dmi'

gi
name = "blue gi"
icon = 'gi.dmi'

pants
name = "black pants"
icon = 'pants.dmi'





DblClick()
if(!src.worn)
wear()
else
remove()





obj
verb
get()
set src in oview(0)
if(istype(src,/obj/zeni))
usr.zeni+=src.amount
usr<<"You get "+commas(num2text(src.amount,12))+" Zeni."
del(src)

else
src.Move(usr)
drop()
if(src.worn)
remove()
src.Move(usr.loc)


Problem description:

my problem is, that i want to call that remove() from the drop() verb. i know if i made remove() in just regular obj/verb that it would work, but i want it to work when i made remove() in obj/clothes/verb.
EDIT: Oops, read that wrong

Look up these two useful procs: hascall() and call()

obj/verb/drop()
if(hascall(src,"remove"))call(src,"remove")()


- GhostAnime
In response to GhostAnime
GhostAnime wrote:
EDIT: Oops, read that wrong

Look up these two useful procs: hascall() and call()

> obj/verb/drop()
> if(hascall(src,"remove"))call(src,"remove")()

- GhostAnime


okay i dont want to make you feel like i just stole your code and don't know what it does. i looked up that stuff and here's what i think that statement does:

if src, (an article of clothing), has a proc called "remove" attached to it, then call that src's proc called "remove" with no arguments. thanks a lot GhostAnime
In response to HXC
I just looked up hascall() and call(), and I am pretty sure you got the gist of it. Good luck in your game.

-Exophus
In response to GhostAnime
I never knew of hascall()! Thanks! This will save me from going through some trouble in the future...

O-matic
In response to Exophus
You're welcome to those who didn't know of it :S

Likewise Exophus, if you don't understand something, look it up :)

But here we go anyways (as sometimes it can be tricky, specially with call's extra brackets):

hascall(Object,ProcName)
---
Object: Should be obvious, but if it isn't, it's the thing we are checking to see if it has a certain verb/proc (ProcName)

ProcName [info for thiscan be found in call()]: This one has two formats.

Format 1: "String Name"
--
This format (eg: "Attack") will look for either a verb or a proc named "Attack" (so if you have a verb named Attack() and the line 'set name = "Something else"', it will NOT use this verb). This may get buggy when you accidently name a proc and a verb the samething, or have atleast two of the samething for one object, however I do not know as I try to avoid it.

Format 2: /path/proc/Here
--
You can set it up to look for a certain proc (Not sure it it will work for a verb path...). This format tends not to be used because Format 1 is much more quicker to type in ;)

Actually, I don't know if this works here at all, I know it does for one format of call()() [yes, there's 2 ()]

call(ProcRef)(Arg) OR call(Object, ProcName)(Arg)
---

ProcRef Refer to Format 2 of ProcName above.

Object Refer to Object above [in hascall()].

ProcName Refer to ProcName above [in hascall()] (I believe now more than ever it's just format 1 for this).

Arg: Also known as Arguments, this is what you want to pass to the verb/proc. See the Example below.


Example
obj/Bomb/verb/Blowup()
set src in usr//verb shows when in usr's contents
if(hascall(usr,/mob/special/proc/selfdestruct)) //again, I do not have a clue if this will work... I am just trying to get across the point of the hascall() and call()() procs... ofcourse I could look for "selfdestruct" in place of the path
call(/mob/special/proc/selfdestruct)(src)

obj/Bomb/Version1
name="Big Bang Bomb" //... if you didn't got it yet, DBZish theme going on here >_<
var/tmp/damage=987289623762782387652
AoE=10 //Area of Effect
mob/Android
New()
..()
proc+=/mob/special/proc/selfdestruct

mob/special/proc/selfdestruct(obj/Bomb/B)
if(!B || !istype(B,/obj/Bomb))return //safety checks are important :o
src.TakeHealth(src.Hp)
for(var/mob/M in range(B.AoE)) M.TakeHealth(B.damage) //I like setting up generalized procs which has reference to deathproc in it.. less time and hassle
for(var/turf/T in range(B.AoE)) T.icon_state="burned"
del(B)


Ummm...yeah... I will make a bwiki for this :P Got one already for min() and max()

- GhostAnime

EDIT: And here it is. Long name I know... >.>