Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Why would this crash Graal? (https://forums.graalonline.com/forums/showthread.php?t=57486)

ChibiChibiLuc 02-05-2005 05:36 AM

Why would this crash Graal?
 
Alright, I've got this in a gani. It shows fading numbers.
When the gani shows, Graal takes a fit, gives me an error, and then says it has an error and crashes.
I'm using Graal v3, of course, and Gscript2.

NPC Code:
function onCreated() {
timeout = .05;
this.fade = 2;
}
function onTimeout() {
timeout = .05;
this.y -= .1;
this.fade -= .1;
showtext(5,x+(20/16),y+this.y,"Times New Roman","b","Oh my");
changeimgcolors(5,#p(1),#p(2),#p(3),this.fade);
}


DarkShadows_Legend 02-05-2005 05:47 AM

I think serverside timeouts are supposed to be no less than 0.1.

goalieboy_01 02-05-2005 05:54 AM

Quote:

Originally Posted by DarkShadows_Legend
I think serverside timeouts are supposed to be no less than 0.1.

You are correct, sir.

Evil_Trunks 02-05-2005 06:12 AM

Quote:

Originally Posted by DarkShadows_Legend
I think serverside timeouts are supposed to be no less than 0.1.

Then it's a good thing he isn't using it serverside.

:rolleyes:

ApothiX 02-05-2005 07:17 AM

Quote:

Originally Posted by DarkShadows_Legend
I think serverside timeouts are supposed to be no less than 0.1.

showtext and changeimgcolors cannot be used serverside, either ;)

Quote:

Originally Posted by ChibiChibiLuc
timeout = .05;

This wouldn't crash your client, but the correct procedure for setting a timeout in the new engine is:
NPC Code:
setTimer(float);



Quote:

Originally Posted by ChibiChibiLuc
changeimgcolors(5,#p(1),#p(2),#p(3),this.fade);

Where are you getting these #p(1) etc from? (And don't use # anything in the new engine)

Lance 02-05-2005 07:20 AM

Quote:

Originally Posted by DarkShadows_Legend
I think serverside timeouts are supposed to be no less than 0.1.

Kindly refer to rule 4 of this forum.

Lance 02-05-2005 07:20 AM

Quote:

Originally Posted by goalieboy_01
You are correct, sir.

You too.

Lance 02-05-2005 07:22 AM

Quote:

Originally Posted by ApothiX
Where are you getting these #p(1) etc from?

It's a gani, dude.

Quote:

(And don't use # anything in the new engine)
Mixing code is not a good idea, but old scripts using old code (including the old message codes) will still work.

ApothiX 02-05-2005 07:26 AM

Quote:

Originally Posted by Lance
It's a gani, dude.

Ah, sorry, I don't use those smelly gani parameters very often ;)

Quote:

Originally Posted by Lance
Mixing code is not a good idea, but old scripts using old code (including the old message codes) will still work.

It's not a good idea, that's why I was trying to deter him from doing so.

Lance 02-05-2005 07:27 AM

Quote:

Originally Posted by ChibiChibiLuc
Alright, I've got this in a gani. It shows fading numbers.
When the gani shows, Graal takes a fit, gives me an error, and then says it has an error and crashes.
I'm using Graal v3, of course, and Gscript2.

NPC Code:
function onCreated() {
timeout = .05;
this.fade = 2;
}
function onTimeout() {
timeout = .05;
this.y -= .1;
this.fade -= .1;
showtext(5,x+(20/16),y+this.y,"Times New Roman","b","Oh my");
changeimgcolors(5,#p(1),#p(2),#p(3),this.fade);
}


To answer your question, I'd need to know if clientside code for the new engine is enabled in ganiscripts.

If it is enabled for ganiscript: this.fade is fairly quickly going to become negative (in 2 seconds). Perhaps it does not like attempting to set a negative alpha? Please post the relevant error messages/console.log.

Lance 02-05-2005 07:29 AM

Quote:

Originally Posted by ApothiX
It's not a good idea, that's why I was trying to deter him from doing so.

Yeah, but you said not to use the old message codes. There's a difference between "Don't use the old message codes" and "Don't mix old and new scripting." The former just names one facet of the old scripting and could also be taken to mean that it's not good to use the message codes in old scripts either, whereas the latter actually provides folks with the advice you were trying to communicate..

ApothiX 02-05-2005 07:38 AM

Quote:

Originally Posted by Lance
Yeah, but you said not to use the old message codes. There's a difference between "Don't use the old message codes" and "Don't mix old and new scripting." The former just names one facet of the old scripting and could also be taken to mean that it's not good to use the message codes in old scripts either, whereas the latter actually provides folks with the advice you were trying to communicate..

I believe I said not to use them in the new engine, I thought by saying that, I implied that it meant to not use it with new engine code. Sorry for any misconceptions.

Lance 02-05-2005 07:47 AM

Quote:

Originally Posted by ApothiX
I believe I said not to use them in the new engine,

The new engine supports both old and new scripting, dude.

Quote:

I thought by saying that, I implied that it meant to not use it with new engine code. Sorry for any misconceptions.
As long as it's cleared up now, it's fine.

ChibiChibiLuc 02-05-2005 04:59 PM

I've got other gani scripts, they all work fine.
And thanks, I forgot to convert the #p()'s.
I originally had it stopping itself when fade hit 0, but I took it out to test if that's what was causing the crash. It wasn't.

It's slightly better now; it doesn't crash Graal every time the gani is shown, but instead it only crashes Graal maybe 1/6 times. Unfortunately, the text won't show. The script, right now, is:

NPC Code:

function onCreated() {
setTimer(.05);
this.fade = 2;
this.damage = params[0];
}
function onTimeout() {
setTimer(.05);
this.y -= .1;
if (this.fade > 0) {
this.fade -= .1;
}
showtext(5,x,y+this.y,"Times New Roman","b",this.damage);
changeimgcolors(5,params[1],params[2],params[3],this.fade);
}



Anyhow, the script that shows the gani is hiding it before fade hits 0.

Edit: Oh yeah, the console doesn't have anything in it about the crash.

Lance 02-05-2005 07:11 PM

Quote:

Originally Posted by ChibiChibiLuc
I've got other gani scripts, they all work fine.
And thanks, I forgot to convert the #p()'s.
I originally had it stopping itself when fade hit 0, but I took it out to test if that's what was causing the crash. It wasn't.

It's slightly better now; it doesn't crash Graal every time the gani is shown, but instead it only crashes Graal maybe 1/6 times. Unfortunately, the text won't show.

Okay, without seeing the script that sets the ani, the steps I'd take to figure out what's wrong:

1) Is the first parameter (params[0]) being sent properly (i.e., is it sent as a string)?

2) Does the showtext work without a variable as the text (and/or without the changeimgcolors)?

3) Are the parameters for the changeimgcolors being sent the way you expect?


All times are GMT +2. The time now is 08:51 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.