ID:161032
 
I know how to make a verb and i'm pretty sure its an if statement thats needs to be used but I don't know exactly how to check locations and how I would write it in a code. If you can help me out with this that would be great and even if you can't thanks anyways for your time.
It's not an if statement, it's either an src setting or verb argument. (Look those up!) Depending on whether you want the verb to affect the area or the player that's accessing the verb, there's different ways to do it.
Gladiatoror wrote:
I know how to make a verb and i'm pretty sure its an if statement thats needs to be used but I don't know exactly how to check locations and how I would write it in a code. If you can help me out with this that would be great and even if you can't thanks anyways for your time.

You could make it an area with a Proc. So like:
mob/Login()
verbs-=/mob/verb/the_verb //Takes the verb away when they login

mob
proc
proc_name()
verbs+=/mob/verb/the_verb //Gives them the verb when this proc is used

mob
area
area_name
usr.proc_name() //Uses the proc when the user is on the area "area_name"

//You can change "proc_name" and "area_name" to whatever.
In response to Hi1
What are you trying to do?
In response to Jemai1
Jemai1 wrote:
What are you trying to do?

He wants the user to get a verb when they are on/in a certain area/space/place...I think I covered it ; )
In response to Hi1
Just like Naokohiro said, changing the src setting is the best way to do it.

BTW, your code won't work.
In response to Hi1
This method overcomplicates it, and I actually don't think it'll even compile. There's two simple ways to do it - One way would be to call it implicitly:

/*From the DM Guide:
In the case of both turf and area, the default accessibility is view(0) and is implicit. Since the range is zero, this gives the player access to the verbs of the turf and area in which the mob is standing.*/


area/dark/verb/clap()
luminosity = 1


Another method would just be to add the verb (Defined under /mob/proc or /mob/inaccessible_mob/verb) to the user's verbs whenever they enter the area and take it away whenever they leave

mob/proc/Some_Proc()
//stuffs

area/yourarea
Entered(mob/M)
if(!ismob(M)) return
M.verbs += /mob/proc/Some_Proc()
Exited(mob/M)
if(!ismob(M)) return
M.verbs -= /mob/proc/Some_Proc()
//
//As a note, you'd want to remove the verb in any proc that //would cause the user to change locations. For example:

mob/proc/Death(mob/killer)
if(src.health > 0) return
world << "[killer] has killed [src]!"
src.loc = locate(/area/purgatory)
if(locate(/mob/proc/Some_Proc()) in src.verbs)
src.verbs -= /mob/proc/Some_Proc()
In response to Darkmag1c1an11
What I meant was these are the two ways:
//First way:
mob/verb/clap(var/area/A as area in view(0,src))
//verb actions
//Second way:
area/verb/clap()
set src in view(0)
//verb actions

You guys are getting way too complicated with this.