How to change an alias with an script? [Solved]

Xilefenko
06 Nov 2016, 14:48

I want that the alias of an object is changed when i run a script In-game
Im a Newbie so easy explanation is appreciated :D


Pykrete
06 Nov 2016, 16:22

It's as simple as 'object.alias = "new alias"'.

Examples;

Egg.alias = "Bomb"
Documents.alias = "Visa"
Money.alias = "Dollars"

Where the first part is the object, the . seperates it and the alias is the attribute you're changing.

It's the same for attributes you yourself add.


Xilefenko
06 Nov 2016, 17:25

Ok thanks. I've forgot to add ""
That was the Problem


hegemonkhan
06 Nov 2016, 22:23

double quotes on a Value makes it be a string (text) value (which means that the Attribute must thus be a String Attribute and vice versa: if you have a String Attribute then its value must be a string value):

player.alias = "HK"

game.greeting = "Welcome to my game, I hope you enjoy it!"

room.description = "blah blah blah blah blah blah blah blah"

orc.look = "He' big, green, ugly, and mean." // the 'look' as a String Attribute. The 'look' can be a Script Attribute instead, but that's not relevant for these String Attribute examples


no double quotes on a Value makes it be an Object (make sure that the Object actually exists, of course) value/reference:

(again, the Attribute and its value types, must match up: Object Attribute and Object reference value)

player.right_hand = sword

<object name="player">
</object>

<object name="sword">
</object>

except for 'true' and 'false', as these are reserved for Boolean Attributes:

orc.dead = false
orc.dead = true


do be warned that there's slight syntax differences between:

in-code (direct coding) and/or using the [EXPRESSION] script option in the GUI/Editor
~VS~
using the scripting options, drop down boxes, and text boxes in the GUI/Editor

yes, it's a bit of annoying confusion, as it's hard to keep it separated/understood correctly.