ID:140083
 
Code:
                    new /mob/rebel(loc=usr.loc, commandingPlayer=usr.ckey)

As you can see I clearly defined commandingPlayer, did I not?

Problem description:
Whenever I try to define it as newRebel.commandingPlayer it gives me an error despite that I've got it defined for the default mob, and when I try it another way it gives me a unused variable warning, which is a load of bull. I define it in the object as a custom var, but when I try to specify what it is it says it is undefined. What is the problem?
You did not define commandingPlayer. You supplied a named argument to new() with the identifier "commandingPlayer", but that is not in any way defining a variable.

In the future, it might be helpful to post the code you are getting an error with, not something completely unrelated to it.
In response to Garthor
Sorry that was jsut one line, I suspected the code would be there. Guess I was wrong.

turf
brickWall
icon = 'brickWall.dmi'
density = 1
woodFloor
icon = 'woodFloor.dmi'
woodWall
icon = 'woodWall.dmi'
density = 1


area
playerStart



mob
maleTownsman
icon = 'maleTownsman.dmi'
femaleTownsman
icon = 'femaleTownsman.dmi'
rebel
name = "A rebel..."
desc = "Bad news for confeds..."
icon = 'rebelSoldier.dmi'
var
commandingPlayer = ""
MouseDrop(over_object,src_location,over_location,src_control,over_control)
if(src.commandingPlayer!=usr.ckey)
usr << "This is not your rebel..."
else walk_towards(src, over_object, 1)
Click()
if(src.commandingPlayer==usr.ckey)
input("Order:") in list("Change name", "Nevermind")
if("Change name")
var/newName = input("New name:") as text
src.name = newName
else usr << "This isn't your rebel"




rebelCommander
Login()
usr.loc=locate(/area/playerStart)
usr.density = 0
verb
zoomOut()
if(client.view==10)
usr << "You've zoomed out enough already!"
else client.view+=1
zoomIn()
if(client.view==3)
usr << "You can't zoom in anymore or else you'll break the laws of BYOND!"
else client.view-=1
recruit_Rebel()
if(src.power<=40)
usr << "You don't have enough power"
if(src.power>=40)
src.power -= 40
new /mob/rebel(loc=usr.loc, commandingPlayer=usr.ckey)


var
power = 200
coal = 100
iron = 100
gold = 10



obj
woodTable
icon = 'woodTable.dmi'
density = 1
coalStove
icon = 'coalStove.dmi'
density = 1
woodChairSouth
icon = 'woodChairSouth.dmi'
density = 1
name = "A wooden chair"
woodChairNorth
name = "A wooden chair"
icon = 'woodChairNorth.dmi'
density = 1
woodChairWest
name = "A wooden chair"
icon = 'woodChairWest.dmi'
density = 1
woodChairEast
name = "A wooden chair"
icon = 'woodChairEast.dmi'
density = 1
bedLeft
name = "A nicely made bed"
icon = 'bedLeft.dmi'
density = 1
bedRight
name = "A nicely made bed"
icon = 'bedRight.dmi'
density = 1


world
mob = /mob/rebelCommander

client
var
currentSoldier
<dm:>

This is the whole code
In response to CodeWeasel22
Named arguments to New() don't automatically modify the variables of the created object. You either need to override New() to take that argument or use the almost-never-used {} initialization syntax:

new /obj {blah = 100}()
In response to Garthor
Thank you! Now my only problem is putting ckey in the initialization statement so it can recognize the player, any thoughts? And thanks again for helping.
In response to CodeWeasel22
You could try putting ckey there.

Just a thought.
In response to Garthor
I already tried that...
In response to CodeWeasel22
Whoops, wasn't thinking: those initializations have to be constant. Silly me. You'll need to use an argument to New():

// First atomic argument is always the location the object is created at, regardless of what we do with New()
obj/New(var/atom/loc, var/X)
..()
src.X = X
In response to Garthor
Alright, I'll see what I can do thanks.