ID:169761
 
How do you access this variable?
mob
player
Guild
Well, first you'd have to define it as a variable.

mob/var/player/Guild = ""


I think, anyways. I seem to get corrected everytime I post help on the forums.
In response to Chance777
This is what I have
mob
player
var
Guild

How do I access it?
In response to BakaSan
Same way you access any other variable. What are you trying to do?
In response to Chance777
I'm trying to make a guild system and it doesnt work with M.Guild. I'm also trying to save it.
In response to BakaSan
Someone Please Help. I need this soon.
In response to BakaSan
M is probably defined as /mob. If it's always going to be of type /mob/player you can define it as var/mob/player/M.
In response to Chance777
Chance777 wrote:
Well, first you'd have to define it as a variable.
mob/var/player/Guild = ""

I think, anyways. I seem to get corrected everytime I post help on the forums.

Well, since you're already braced for it, here goes: Why are you setting this to an empty string if it's defined as a /player datum? While this is technically legal, there's no reason to do it. Why not just leave it with the default value, null?

Lummox JR
In response to Lummox JR
mob
proc
CChar()
var/char_name = input("New character", null, "What is the character's name?") as text
var chartown = input("Choose your Home Village",null,"What is your Home Village?") in list("Leaf")
var/charmas = input("Choose Skill",null,"Choose a skill for you character to exel in.") in list("Taijutsu","Genjutsu","Ninjutsu")
var/mob/player/Nin
var/mob/player/Tai
var/mob/player/Gen
var/mob/player/Vill
var/mob/player/Name
if(charmas == "Ninjutsu")
Nin = 80
Tai = 20
Gen = 50
else if(charmas == "Taijutsu")
Nin = 20
Gen = 20
Tai = 110
else if(charmas == "Genjutsu")
Nin = 50
Tai = 20
Gen = 80
Vill = chartown
SaveF(Name,Nin,Gen,Tai,Vill)
return char_name
return Nin
return Gen
return Tai
return Vill
src.loc=locate(/turf/LeafStart)
SaveF(Name,Nin,Gen,Tai,Vill)
var/savefile/F = new("players.sav")

// Get the ckey() version of the name to avoid illegal characters for a directory name.
var/safe_name = ckey(Name)

// Move to the directory for this character, which is:
// /player_ckey/character_ckey
F.cd = "/[ckey]/[safe_name]"

// Storing the actual name as a value (not a directory), so we don't have to worry about what characters it has.
F["Name"] << Name
F["Level"] << Level
F["Guild"] << Guild
F["GT"] << GT
F["Nin"] << Nin
F["Gen"] << Gen
F["Tai"] << Tai
F["CC"] << CC
F["Fnd"] << Fnd
F["Village"] << Vill
F["BMast"] << BMast
F["KMast"] << KMast
F["TMast"] << TMast

This is what I'm using it for.
In response to BakaSan
Well, you seem to have replied to the wrong post here, but I'm very concerned about this:

return char_name
return Nin
return Gen
return Tai
return Vill
src.loc=locate(/turf/LeafStart)


I have no idea what that's supposed to do, but it won't do it. You can only return one value from a proc, and once you do, it's done. None of the code after that first return line will ever run.

Lummox JR
In response to Lummox JR
So how would you access Guild?
mob
var
player
guild

I gives me an error that the variable's undefined type.

The code in the previous post was to create a character and save all the data into a file.
In response to YMIHere
All the varriables I have here are all under mob/var/player/
In response to BakaSan
That suggests to me that the problem is that you don't understand typecasting.

http://www.byondscape.com/ascape.dmb/YMIHere.2005-0322/

Hopefully, that'll help.
In response to Jp
The simple answer is just use M:guild istead of M.guild. Since you are accessing a mob/player/var in a mob/proc, you have to use the :.
In response to DarkSkythe
You're telling someone to use <code>:</code>? When there are alternatives available?
In response to DarkSkythe
DarkSkythe wrote:
The simple answer is just use M:guild istead of M.guild. Since you are accessing a mob/player/var in a mob/proc, you have to use the :.

No you don't. That's bogus advice. You never "need" the colon operator; it's merely convenient for certain situations. In this case it does not belong there, because it would mask over a conflict of types. You just have to make sure you handle types correctly.

The problem is either that 1) this shouldn't be a mob proc, but a mob/player proc, or 2) this shouldn't be a mob/player var, but just a mob var.

Lummox JR