class attribute list?

crystalwizard
22 Jan 2017, 21:52

Is there a list of the attributes of the starting classes? Specifically (for now) the objects class? I'd like to reference an object by name but unfortunately object.name gives me an error


Jay Nabonne
22 Jan 2017, 22:00

If you select "Show Library Elements" under Filter at the bottom of the left pane in the Windows editor (assuming you're using that one), then under Advanced and then under Object Types, you'll find types like "defaultobject", "defaultexit", etc. However, you can't access the members of a type. You can view them yourself, but you can't actually access them in code.

Now, I don't know what you mean by "reference an object by name" (since you should be able to - for example, see GetObject) or why you'd want to go to the base type, as each object has its own unique name, which is set when the object is created. So the base type "name" attribute is irrelevant. Can you elucidate a bit what you're trying to do?


crystalwizard
22 Jan 2017, 22:03

I'd like to write this:

"The" object.name "weighs" object.weight "grams."

I defined weight, but the object when I created it was given a text identifier that I would like to reference as its name.

what i'd really like is to be able to look at the object class and see what predefined attributes it has so I can call them if I'd like to


Jay Nabonne
22 Jan 2017, 22:14

If you know the object you want then you can use the text processor:

msg ("The {player.name} weighs {player.weight} grams")

Otherwise, if you have (say) a variable named "object", you can do:

msg ("The " + object.name + " weighs " + object.weight + " grams")

To see the attributes, check out the "defaultobject" type as I mentioned before. You can view the attributes in the Attributes tab. You can also look at any object, on its attributes tab, and the attributes from the base type will be a darker color.

Or you can use the debugger when running to see what attributes an object has on the fly... The source of the attribute will be in the right column.


crystalwizard
22 Jan 2017, 22:32

nvm. I found the issue. Missing + marks.


hegemonkhan
22 Jan 2017, 23:59

msg'ing VARIABLE + TEXT:

the secret trick, is to break it up into chunks:

there's two types of chunks:

1. "text/string"
2. + VARIABLE +

so, for example: HK is a 18 year old adult male human warrior.

player.alias = "HK"
player.sex = "male"
player.age_string = "adult"
player.integer_integer = 18
player.race = "human"
player.class = "warrior"

msg (player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + ".")

the chunks: 12

1. player.alias +
2. " is a "
3. + player.age_integer +
4. " year old "
5. + player.age_string +
6. " "
7. + player.sex +
8. " "
9. + player.race +
10. " "
11. + player.class +
12. "."