ID:156612
 
This is probably not exactly what you expected from the title. Here is my code

            Drive()
set (src) in usr.Mechs
if(usr.loc == locate(/area/Mech))
usr.underlays += src
usr.icon_state = "null"
usr << "You get inside the T-Tank"
else
sleep(30)
usr.GroundTraining3() // Send player to next stage in Ground Training


This is the obj/Mech's verb. However, when I compile it says usr.Mechs: unsupported src setting. So what type of procedure should I be using to find this variable? Is it possible for me to search the user's Mech list for it? Or should I even be using this method at all?
Taken directly from the reference:

Args:
List: One of view(), oview(), world, world.contents, usr, usr.contents, or usr.loc
With the first format, if src is in List for a particular player, then that player will have access to the proc. The player must explicitly specify the name of the source on the command line.

The second format behaves the same, except the source is not read from the command line. If more than one possible source exists, one will be chosen at random.

When usr or world is specified for the first format, it will be expanded to usr.contents and world.contents respectively.

The default setting depends on the type of src:

mob: src = usr
obj: src in usr // short for usr.contents
turf: src = view(0)
area: src = view(0)


There are a few ways to simulate this behavior... But I would advise just setting it to anyone who was in range to use the verb, and then testing to see if the player owns the mech. It's the easiest solution.
In response to Ter13
Doah, thanks. I couldn't find it in the ref because I kept searching through the set stuff. src settings never crossed my mind. Thanks for info. Still, this verb is a mech verb, and the user can only use it if the Mech is in a Mech list, which is a variable.
Also note that this line:

                if(usr.loc == locate(/area/Mech))


will probably never return true, unless that area has no turfs in it. What you'd want is:

if(loc && istype(loc.loc, /area/Mech))
In response to Lugia319
Nope. Doesn't work like that. You can't set src in a custom defined list.

Are you trying to make this verb usable if the mech object is near the player or are you trying to make any mech the user owns usable through an "inventory"-like method?

Why not add the mech object to the user's contents? Then you can use "set src in usr"

Or, you can go into the Stat() proc and actually loop through the user's mech list and show them in a statpanel. If the verb doesn't have a src setting, you should be able to right-click on the mech and use the drive verb from the menu directly.
In response to Ter13
Without a src setting, it'll default to "set src in usr".
In response to Ter13
It's very similar to an inventory yes, but I wanted to make it so that the Mechs had their own part of the contents and the equipment the player may buy be put in contents. I didn't know any way to do that so I made the mechs list for the mechs.

I'm trying to make it so the player may only use this verb if they own the Mech (Which would be shown in the Mechs list)
In response to Garthor
Touche... I posted that, didn't I?

Way to look like a jackass there Ter!
In response to Lugia319
Check this out:

Stat()
statpanel("inventory")
for(var/obj/item/I in src.contents)
stat(I)
statpanel("mechs")
for(var/mob/mech/M in src.contents)
stat(M)


Two birds, one stone.
In response to Ter13
Goddess Dangit Ter, why must you always make me feel like an idiot for forgetting things?
In response to Garthor
Oh! Did not know that! Thanks Garthor.
In response to Lugia319
That's my job. 8D
In response to Ter13
You'd probably want to maintain two separate lists anyway, so you can just use those.
In response to Garthor
Yeah, but it breaks the verb showing up in the panel.

This is why I never use verbs (Even though technically you have to, I know, don't call technicality), and stick to click/keyboard interaction.
In response to Ter13
No, I'm saying put EVERYTHING in contents, then maintain an inventory list and a whateverelse list, in addition to that.
In response to Garthor
Extra overhead, but you have to do what you have to do.
In response to Ter13
Extra overhead compared to looping through contents twice every few ticks?
In response to Garthor
Foot. Mouth.