ID:140107
 
Code:
mob
Login()
client.mob = new /mob/player
var/client/mob/currentCash
var/client/mob/currentName
var/client/mob/currentRank
var/client/mob/currentBranch

proc
createData(ckey)
var/savefile/F = new("" + ckey + ".sav")
F["cash"] << 0
F["name"] << ""
F["rank"] << 0
F["branch"] << 0

saveData(ckey, client)
var/savefile/G=(""+ckey+".sav")
G["cash"] << currentCash
G["name"] << currentName
G["rank"] << currentRank
G["branch"] << currentBranch

loadData(ckey, client.mob)
var/savefile/E=(""+ckey+".sav")
E["cash"] >> currentCash
E["name"] >> currentName
E["rank"] >> currentRank
E["branch"] >> currentBranch


Problem description:
FOR STARTERS, DO NOT CALL ME A NOOB. If your angry and just wish I'd get the clue, don't help me. I don't need the attitude. But the problem is, that I'm having issues accessing vars. Above is my code, and what I can't seem to figure out is how I can access the variables assigned at login. Can anyone please shed some light on the situation.
Variables defined within a procedure (like mob/Login() there) are not accessible outside that procedure.

Also realize that by changing client.mob, the current mob will no longer be src (because you've changed which mob is theirs), and Login() for the NEW mob will be called.
In response to Garthor (#1)
Oh, I see. Thank you for at least pointing that out, I wasn't aware of that caveat to programming with BYOND. Thank you also for being polite in response.
    player
icon = 'concrete.dmi'
var
currentCash
currentName
currentRank
currentBranch


In either case, I defined it in the mob, what am I doing wrong still? >_> I'm sorry.
In response to CodeWeasel22 (#2)
You defined it under /mob/player, which is also not visible for /mob/proc/whatever().
In response to CodeWeasel22 (#2)
CodeWeasel22 wrote:
Oh, I see. Thank you for at least pointing that out, I wasn't aware of that caveat to programming with BYOND. Thank you also for being polite in response.
>   player
> icon = 'concrete.dmi'
> var
> currentCash
> currentName
> currentRank
> currentBranch
>


In either case, I defined it in the mob, what am I doing wrong still? >_> I'm sorry.

Where you define variables extends beyond just DM. Look up 'scope (programming)'.