ID:2596475
 
(See the best response by Lummox JR.)
Code:
obj/map/build_map
verb/Delete_Tile()

if(usr.tile_view)
set src in view()
set category = null


Problem description:

Trying to make it so these objects only display commands attached to them to players when they have a specific var toggled.

The above code is showing the verb regardless of whether the "tile_view" var is enabled or disabled.
Best response
The only way to do this is to come at it a different way. The delete tile verb should be a mob proc, with an "in world" argument that will be the tile to delete. Add that proc to the mob's verbs list when it's appropriate, and remove it when it's no longer relevant.
Alright. I've been playing around with it a bit.

I'm trying to restrict the verb to specific objs but it doesnt seem to be working. I'm not sure why.

mob/verb/Delete_Tile(obj/map/build_map/O as obj in usr.my_tile_list)


The verb itself does work but it shows on right-click with any obj, not just the obj in that list. Trying to use it on an incorrect obj gives the obvious invalid syntax errors in game to the player.

Is there a way to allow these verbs to show on 1 obj without showing on an obj of a different type?
I don't know if "in list" can be used to restrict right clicks because that requires a server query. If that part works it will be slower.

I *do* know that specifying the type path will have no effect. Verbs can only restrict their args to basic types like obj, mob, etc.

Of course a bigger question in all this is why you're using a verb interface for this purpose. Some alternative UI would seem more desirable.
In response to Lummox JR
Lummox JR wrote:
I don't know if "in list" can be used to restrict right clicks because that requires a server query. If that part works it will be slower.

I *do* know that specifying the type path will have no effect. Verbs can only restrict their args to basic types like obj, mob, etc.

Of course a bigger question in all this is why you're using a verb interface for this purpose. Some alternative UI would seem more desirable.

I'm trying to use it for a bit of a custom map builder where players can design their own arena but not affect other player's areas. If they're in their area, and they toggle the build mode option option on, they can lay down and delete objs in their area. Right-Clicking seems to be the simplest way to manipulate this.

I was initially going to map it to a hotkey + click but after testing it, it became somewhat unwieldy when there was more than 1 layer involved or when a tile involved transparency since you would click the layers below it by mistake. While right-click will give you a list of all of the objs on that coordinate.

I was trying to use the list option since it seems to be an option in the documentation for verb arguments but it doesn't work.

set_aggression(a="on" as null|anything in list("on","off"))


Is the given as an example in verbs > arguments which I THOUGHT I was following, but either the example is wrong or I'm screwing something up.
Do you really have to hide the verb? I would just give the turfs an "owner" variable, then give the player a "can't edit this" type message when they try to build on a turf for which they aren't the "owner"