PDA

View Full Version : Gani script problem


Crow
10-09-2007, 07:19 PM
Well, I got a problem. I got a script in a gani, which should change the color of something everytime you change the value (got a player.attr for red, green and blue). This is how the part with the script looks:

SCRIPT
function onCreated() {
onTimeOut();
}
function onTimeout() {
for (temp.i=200;i<=203;i++) {
with (findimg(i)) {
red = player.attr[20] / 255;
green = player.attr[21] / 255;
blue = player.attr[22] / 255;
}
}

setTimer(.05);
}
SCRIPTEND

So it changes the colors of 4 sprites in the gani. Well, that does work, though you have to reconnect to see the changes. That didnt happen before, I got an extra gani just for that now, and when that stuff was still in the regular ones, it worked fine. So I tried something out, and found out that the timeout for some pretty weird reason will only run through once, and I have no idea why. So, I need some help here :]

DustyPorViva
10-09-2007, 09:15 PM
function onPlayerenters()
I believe, instead on onCreated()

zokemon
10-09-2007, 10:35 PM
Yes, use onPlayerenters() like Dusty said.

Crow
10-10-2007, 02:51 PM
I will try that. Seems a little weird though, because it worked with onCreated() before.

Edit: Didnt work, its still not working properly :/

Edit2: The onPlayerEnters did fix it, just had some syntax error, hehe. Thanks alot :]