ID:160742
 
Idea: when a player enters a certain location that the player owns, the player is presented with the option to edit this location. Answering Yes to this question, I wish to add 2 verbs to the player's available verb list: a Push and a Pull verb.

Dilemma: I've got
verbs += obj/TentStuff/Tents/proc/Pull
however DM says that a
proc definition not allowed inside another proc
even though it is obvious that I'm not trying to do such a thing.

Question: What is one foolproof way of adding (and removing) the Pull and Push verbs?
verbs += obj/TentStuff/Tents/proc/Pull


If your trying to add a verb, why is Pull under a proc?

It should be

verbs += obj/TentStuff/Tents/verb/Pull
In response to DarkGamer
No, proc is (most likely) correct. If it was verb, then the object would automatically start with it. The problem is that type paths must start with a /.

verbs += /obj/TentStuff/Tents/proc/Pull
In response to Nickr5
Well yes, but what if the verb was set hidden? You would have to give the usr that verb.
In response to DarkGamer
I don't see how that relates to my post, but no. Setting it to hidden only hides the verb from the commands panel and prevents it from being shown in the auto-complete list in input controls - the user can still access it by typing it directly. If a verb/proc is removed from the verbs list, then the client can't access it at all.
In response to Nickr5
Try using typesof(). I'm not sure if you can use a proc in that but you can try?
it would be typesof (works for me anyways :P)
verbs += typesof(/obj/TentStuff/Tents/verb/Pull)
In response to KingCold999
I'm pretty sure that wouldn't work. You can't say type/verb/Pull, you would have to say

verbs += typesof(/obj/TentStuff/Tents/verb/)
The problem isn't with this line of code in the way you think it is, even though Dream Maker is reporting it there. You've got improper indentation somewhere.
In response to Popisfizzy
Popisfizzy wrote:
The problem isn't with this line of code in the way you think it is, even though Dream Maker is reporting it there. You've got improper indentation somewhere.

Let me quote the code - straight from the first "obj" line w/ no edited indents: (edited for length)
obj
//...
Movable //Added to separate movable objects from non-movable
//...
TentStuff
//...
Tents
//...
/*proc //Commented until fixed
Pull(obj/item as obj in oview(1))
item.loc = usr.loc
Push(obj/item as obj in oview(1))
switch(usr.dir) //find the direction pushing
if(NORTH)
var/tmp/newy = src.y + 1
var/tmp/newx = src.x
if(SOUTH)
var/tmp/newy = src.y - 1
var/tmp/newx = src.x
if(EAST)
var/tmp/newy = src.y
var/tmp/newx = src.x + 1
if(WEST)
var/tmp/newy = src.y
var/tmp/newx = src.x - 1
else
var/tmp/newx = src.x
var/tmp/newy = src.y
item.loc = locate(newx,newy,src.z)
verb
EnterTent()
set src in view(1)
usr.loc = locate(src.EntranceX,src.EntranceY + 1,src.TentID) //put usr in tent
if(src.Owner == usr.key)
if(alert("Edit the tent's contents?","Enable Edit Mode?","Yes","No") == "Yes") //ask if the usr wishes to edit the tent contents
While(usr.loc != locate(src.EntranceX,src.EntranceY,src.TentID)) //so long as the usr does NOT enter entrance point
verbs += /obj/TentStuff/Tents/proc/Pull //add these verbs
verbs += /obj/TentStuff/Tents/proc/Push
verbs -= /obj/TentStuff/Tents/proc/Pull //upon touching the entrance point, remove the verbs...
verbs -= /obj/TentStuff/Tents/proc/Push
usr.loc = locate(src) //...and put the usr outside of the tent
else
alert("Got it.","") //State that the client realizes that the usr does not wish to edit tent
While(usr.loc != locate(src.EntranceX,src.EntranceY,src.TentID)) //wait for usr to enter entrance point
usr.loc = locate(src) //put the usr outside

else
alert("This tent is owned by [src.Owner].","Owner Information") //state tent's owner
//*insert exit coding here* */


I doubt that the error is due to faulty indentation. (I'd bet now this thread is about to be moved to Code Problems forum...)

I just realized something... I've got "add verbs to usr's list every tick while usr is in tent..." I gotta fix that error...