Well I am trying to learn DM and have been reading through the guide, I have used DM to even make a game in the past when I first joined here(years ago) but back then I more or less just copy/pasted libraries and others code then modified them to make a paintball game. This time around I am actually trying to learn it myself to make my own code, in doing so I have a question with arguements in verbs.
The DM guide doesn't make much since to me in chapter 4, what is the difference between in and as?
What would the difference be between this:
mob/verb/poke(M as mob in view(1))
view() << "[usr] pokes [M]!"
And this:
mob/verb/poke(M as mob as view(1))
view() << "[usr] pokes [M]!"
Thanks for any help, I will probably run into a lot of small questions like this so if anyone is willing to maybe add me to Skype and help every so often I would be very grateful!
ID:155105
Sep 17 2011, 10:30 am (Edited on Sep 17 2011, 10:37 am)
|
|
In response to Robertbanks2
|
|
Alright, thanks for the help and links makes sense now :D.
|
And
http://www.byond.com/ members/?command=reference&path=operator%2Fin
They are two completely different things.
The "in" operator checks to see if the left hand argument is contained within the right hand argument(which must be a list).
The "as" operator tells a proc/verb which input type an argument is. If you're going with a datum/atom, rather than a variable type, you should probably be using type casting instead, such as var/mob/M as opposed to M as mob. "as" is more useful in telling a proc that a certain argument should always be a certain type of variable(text, num, savefile, etc), or when you need to run the same block of code for multiple types of datums/atoms in a list.