Ive implemented the following code into my Global Script:
function FaceDirection(int charid, string direction) {
// script for ego to face a direction
if (StrComp(direction,"down")) {
FaceLocation(charid,character[charid].x,character[charid].y+10);
}
if (StrComp(direction,"front")) {
FaceLocation(charid,character[charid].x,character[charid].y-10);
}
if (StrComp(direction,"left")) {
FaceLocation(charid,character[charid].x+10,character[charid].y);
}
if (StrComp(direction,"right")) {
FaceLocation(charid,character[charid].x-10,character[charid].y);
}
}
but when i call FaceDirection (EGO, left);
i get a compile error such as undefined symbol "left"
any ideas?
Quotes
what u mean """?;)
nah thats not the problem its supposed to be like that.
the function properties display it as "left" and you call FaceDirection left without quotation marks. The whole point is to make this all easier.
i tried adding quotation marks in suspicious places removing them what exactly do you mean Quotes?
I mean you need to call the function with:
FaceDirection (EGO, "left");
for example
tried that ages ago
gives an error too
What error?
How is your script header set up? I've jst tried your code, calling with "left", not left and it works fiune for me. My script header has:
import function FaceDirection(int, string);
oops again i forgot the (int, string);
;D
Actually, I think this is a common thing to forget and it would be nice if CJ could produce a better error message when your import doesn't match the global function definition...
I knwo becuase I did the same as subspark did first time, then I checked the manual and fixed it.
Aye, that's been on my list for a while, but it's a bit fiddly to implement so I keep putting it off.
I'll get round to it at some stage though, promise ;)