Sorry to start a whole topic about this, but... if I'm writing my own function, what do I write as a parameter if I want to be able to call a character's script name? Also, can I set a variable to a character's script name? If so, can I use that variable in place of the character's script name in front of a function?
kind of like;
if (blah blah) thisthing = cEgo;
function (int charid) {
if (charid==cEgo) blah;
charid.Walk(blah);
etc.
Due to the OO update of the engine and backward compatibility, you can do this in various favours now.
1. Use Character*:
function (Character* charpointer) {
Ã, if (charpointer==cEgo) blah;
Ã, charpointer.Walk(blah);Ã,Â
2. Use the ID, or type int:
function (int charid) {
Ã, if (charid==cEgo.ID) blah;
Ã, character[charid].Walk(blah);
Thanks!! You just saved me many lines of code ^_^
(All due thanks to CJ for making the scripting awesome in the first place)
Also, the script name can still be used as an int (not the script-o-name, so EGO not cEgo) equilvalent to Character.ID, as you're doing with Bernie's FollowCharacter module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25121.0). So, a third way:
function (int charid) {
if (charid==EGO) blah;
character[charid].Walk(blah);
So there's no way I can just assign a char o-name in a normal script, like:
girl = cBryn;
?
If girl is of type Character*, then Yes:
Character* girl;
girl = cBryn;
Ah! Fantastic! :D Thanks.
EDIT: How do I define Character* girl; ?
I get errors when I stick it in my global script with all the other defines. Plus, Character* doesn't turn blue like 'int' and 'string', so...
Yes, just putting
Character* girl;
in your script, wherever you would normally use
int blah;
or whatever is fine.
If you're having errors, could you post the error message and a snippet of the script you're using?