PDA

View Full Version : Script errors


bscharff
03-29-2008, 10:13 PM
I'm not sure why It's doing this...


Script compiler output for Class bloo_intercom:
Script bloo_intercom updated by bscharff

Here's the script

function onCreated(){
join("bloofunctions");
setimg("angel_speaker.png");
setshape(1, 32, 32);
setTimer(0.05);
}

function onTimeout(){
if (this.id != NULL){
this.attr[2] = findnpc("BlooIntercoms").(@this.intid).message; //Message
this.attr[3] = findnpc("BlooIntercoms").(@this.intid).from; //From
}
setTimer(0.05);
}

function onActionLeftMouse(){
if (player.chat.starts("/intercom") && queryRight("intercom")){
tokens = player.chat.tokenize();
command = tokens[1];
p1 = tokens[2];
p2 = tokens[3];
p3 = tokens[4];
if (command == "register"){
this.intid = abs(int(p1));
findnpc("BlooIntercoms").doRegister(this.intid, this.level, this.x, this.y);
}
if (command == "clear"){
findnpc("BlooIntercoms").sendMessage(this.intid, "", ([email protected]" ("@[email protected]")"));
}
}
}

//#CLIENTSIDE
function onCreated(){
join("bloofunctions");
setTimer(0.05);
}

function onTimeout(){
if (this.attr[2] != NULL && this.attr[2] != ""){ //Message
showtext(1, x+0.5, y-1, "Arial", "b", doParse(this.attr[2]));
changeimgzoom(1, 0.5);
changeimgcolors(1, 1, 1, 1, 0.9);
}else{
hideimg(1);
}
if (this.attr[3] != NULL && this.attr[3] != ""){ //From
showtext(2, x+0.5, y-2, "Arial", "b", doParse(this.attr[3]));
changeimgzoom(2, 0.5);
changeimgcolors(2, 1, 1, 1, 0.9);
}else{
hideimg(2);
}
setTimer(0.05);
}


I can't find anything wrong with it...
Can y'all?

This is a request for help, NOT A REQUEST FOR CRITIQUE/HARASSMENT!

Tigairius
03-29-2008, 10:58 PM
You have a space after //#CLIENTSIDE

cbk1994
03-29-2008, 11:00 PM
What server is this for? And does it not give a specific error?

Try checking things such as breaks where they should be, and no spaces after //#CLIENTSIDE, etc.

Also,


if (this.id != NULL){

'id' is reserved, meaning it is the ID of the object. You can't set it. That may be your problem.

And then, on serverside, timeouts need to be .1 or higher, unlike .05 on clientside.

EDIT:

AHHH!! Tig beat me to it mentioning the space after clientside.

bscharff
04-06-2008, 04:08 AM
Would a space after //#CLIENTSIDE actually do that?
Wow...

Oh wait... on RC it doesn't show a space after the //#CLIENTSIDE

and I think I recently changed the this.id varname to this.intid
Thanks lol.

New version:

function onCreated(){
join("bloofunctions");
setimg("angel_speaker.png");
setshape(1, 32, 32);
onTimeout();
}

function onTimeout(){
if (this.id != NULL){
this.attr[2] = findnpc("BlooIntercoms").(@this.intid).message; //Message
this.attr[3] = findnpc("BlooIntercoms").(@this.intid).from; //From
}
setTimer(0.1);
}

function onActionLeftMouse(){
if (player.chat.starts("/intercom") && queryRight("intercom")){
tokens = player.chat.tokenize();
command = tokens[1];
p1 = tokens[2];
p2 = tokens[3];
p3 = tokens[4];
if (command == "register"){
this.intid = abs(int(p1));
findnpc("BlooIntercoms").doRegister(this.intid, this.level, this.x, this.y);
}
if (command == "clear"){
findnpc("BlooIntercoms").sendMessage(this.intid, "", ([email protected]" ("@[email protected]")"));
}
}
}

//#CLIENTSIDE
function onCreated(){
join("bloofunctions");
setTimer(0.05);
}

function onTimeout(){
if (this.attr[2] != NULL && this.attr[2] != ""){ //Message
showtext(1, x+0.5, y-1, "Arial", "b", doParse(this.attr[2]));
changeimgzoom(1, 0.5);
changeimgcolors(1, 1, 1, 1, 0.9);
}else{
hideimg(1);
}
if (this.attr[3] != NULL && this.attr[3] != ""){ //From
showtext(2, x+0.5, y-2, "Arial", "b", doParse(this.attr[3]));
changeimgzoom(2, 0.5);
changeimgcolors(2, 1, 1, 1, 0.9);
}else{
hideimg(2);
}
setTimer(0.05);
}

Imperialistic
04-06-2008, 04:25 AM
A space can do that I believe. Believe it or not, spacebar is actually a hidden character, somewhat.

Inverness
04-06-2008, 05:15 AM
Did you forget to change this.id to this.intid at the beginning of the onTimeout() on serverside?

And yes a single space after //#CLIENTSIDE will mess everything up x-x

Chompy
04-06-2008, 01:04 PM
If you comment out line 12 the error won't appear

All you need to do is change obj.message into something else, voilá


this.attr[2] = findnpc("BlooIntercoms").(@this.intid).message

Change message into msg for example and it should be fixed

cbk1994
04-06-2008, 02:43 PM
Silly little error ;)

And what server is this for?

Dan
04-06-2008, 08:12 PM
Why not use serverside images for this? You could exclude the timeout on clientside then, which is less CPU for the slow-PC gamer. Not sure if a timeout of 0.05 on serverside is good either ;)

Inverness
04-06-2008, 08:30 PM
I just noticed that, DO NOT USE A TIMEOUT ON SERVERSIDE.

cbk1994
04-07-2008, 12:38 AM
Once again, what server is this for?

xXziroXx
04-07-2008, 12:53 AM
I reccon this should do the trick for that line in question..


this.attr[2] = findnpc("BlooIntercoms").(@this.intid @ ".message")

Inverness
04-07-2008, 04:01 AM
I reccon this should do the trick for that line in question..


this.attr[2] = findnpc("BlooIntercoms").(@this.intid @ ".message")


this.attr[2] = findnpc("BlooIntercoms").(@ this.intid).message;
or
this.attr[2] = BlooIntercoms.(@ this.intid).message;

You don't put a period inside the parenthesis thingy. You can only do that with makevar().

cbk1994
04-07-2008, 04:50 AM
Maybe something like this:


this.attr[2] = findnpc("BlooIntercoms").(@this.intid).( @ "message" );

napo_p2p
04-07-2008, 07:24 AM
Maybe something like this:


this.attr[2] = findnpc("BlooIntercoms").(@this.intid).( @ "message" );


Yucky! :P

Inver's would work just fine ;).

Inverness
04-07-2008, 10:41 PM
Maybe something like this:


this.attr[2] = findnpc("BlooIntercoms").(@this.intid).( @ "message" );

Absolutely not.

cbk1994
04-07-2008, 11:20 PM
What's yucky about it?

Inverness
04-07-2008, 11:29 PM
What's yucky about it?Compare mine to yours.

Chompy
04-08-2008, 12:07 AM
function onCreated() {
echo(findnpc("rawr").message); // If the npc exists or not doesn't matter
}
/*
Script compiler output for ChompyTest:
Weapon/GUI-script ChompyTest added/updated by Chompy
*/


So, actually Chris' script wouldn't output the 'Script compiler ...' line ;o

cbk1994
04-08-2008, 01:24 AM
I thought the problem was that it was rejecting any string named message, therefor, it wouldn't let you do x.message ... ?

Chompy
04-08-2008, 02:59 PM
I thought the problem was that it was rejecting any string named message, therefor, it wouldn't let you do x.message ... ?

Actually it only only happens when using findnpc, findplayer, findlevel, actually, any function like object, odd huh?

All these scripts will produce the line :p

function onCreated() {
echo(findplayer("Chompy").message); // if the player exists or not doesn't matter
}
/*
Script compiler output for ChompyTest:
Weapon/GUI-script ChompyTest added/updated by Chompy
*/


function onCreated() {
echo(findad("pepsi").message); // doesn't matter if the function exists
}
/*
Script compiler output for ChompyTest:
Weapon/GUI-script ChompyTest added/updated by Chompy
*/


function onCreated() {
echo(findbirdandpatit().message); // you get the point..
}
/*
Script compiler output for ChompyTest:
Weapon/GUI-script ChompyTest added/updated by Chompy
*/


Now, the weird thing about it is..

this works:


function onCreated() {
temp.a_b = new TStaticVar();
temp.a_b.c = "foo";

temp.b = "_b";

echo(makevar("a"@b).c);
}
/*
foo
*/


while this doesn't

function onCreated() {
temp.a_b = new TStaticVar();
temp.a_b.message = "foo";

temp.b = "_b";

echo(makevar("a"@b).message);
}
/*
Script compiler output for ChompyTest:
Weapon/GUI-script ChompyTest added/updated by Chompy
*/

Skyld
04-08-2008, 03:14 PM
It is possibly something to do with function prototyping (whereby functions are child members of an object with the same name). I guess if some object has a message() function, you can probably not use the same variable name.

Not sure why that would happen with objects returned from findplayer() though.

Admins
04-08-2008, 09:39 PM
Hmmm doesn't seem to be a new problem, same error on older servers. It has the same problem with any funcname().oldscriptcommand, e.g. funcname().loadmap, seeing loadmap as the GS1 loadmap() function and ignoring funcname(). (and giving error when being put in echo() or similar). I will check if that can be fixed easily.

xXziroXx
04-08-2008, 11:59 PM
this.attr[2] = findnpc("BlooIntercoms").(@ this.intid).message;
or
this.attr[2] = BlooIntercoms.(@ this.intid).message;

You don't put a period inside the parenthesis thingy. You can only do that with makevar().

Wrong. I'm using it on multiple places.

TStaticVar() = this.attr[2] = findnpc("BlooIntercoms").(@ this.intid).message
Normal var = this.attr[2] = findnpc("BlooIntercoms").(@ this.intid ".message")

Inverness
04-09-2008, 01:01 AM
Wrong. I'm using it on multiple places.

TStaticVar() = this.attr[2] = findnpc("BlooIntercoms").(@ this.intid).message
Normal var = this.attr[2] = findnpc("BlooIntercoms").(@ this.intid ".message")Well okay then, feel free to promote bad habits.

Tolnaftate2004
04-09-2008, 01:06 AM
Normal var = this.attr[2] = findnpc("BlooIntercoms").(@ this.intid ".message")

This doesn't work.

xXziroXx
04-09-2008, 01:45 AM
Inverness, Pfa - sorry. I scaned some of my older scripts where I was sooo sure I used it, and only examples I could find was with makevar().

l2think, right?

zokemon
04-09-2008, 11:49 AM
Inverness, Pfa - sorry. I scaned some of my older scripts where I was sooo sure I used it, and only examples I could find was with makevar().

l2think, right?

I'm pretty sure PFA is referring to that fact that you did not concatenate this.intid and ".message" together which would cause a compiler (syntax) error, not a run-time error.

xXziroXx
04-09-2008, 05:22 PM
I'm pretty sure PFA is referring to that fact that you did not concatenate this.intid and ".message" together which would cause a compiler (syntax) error, not a run-time error.

I wasn't even looking at the var names or anything, I simply took what was written and showed the syntax I was so sure I had used in the past.

Admins
04-10-2008, 05:48 PM
Ok fixed the problem, the new npcserver will be uploaded in a few days. It was accepting GS1 commands after closing brackets ")", but not correctly handling the case "functioncall().variablename".

cbk1994
04-11-2008, 12:30 AM
Bloo, what server is this for?

bscharff
04-13-2008, 01:13 AM
Sorry, I've been working on my server for a while.

It's for no one in particular... I honestly just got bored and decided to make something useless lol.

cbk1994
04-13-2008, 01:24 AM
Fine, but get rid of bloofunctions if it isn't for Utopia.

zokemon
04-13-2008, 09:52 AM
Ehh? What's bloofunctions? You shouldn't peak people's curiosity like this, it's mean.

Codein
04-13-2008, 11:45 AM
Ehh? What's bloofunctions? You shouldn't peak people's curiosity like this, it's mean.

Possibly a set of functions that were uploaded on Utopia, which Chris may have contributed towards.

cbk1994
04-13-2008, 03:39 PM
Ehh? What's bloofunctions? You shouldn't peak people's curiosity like this, it's mean.

It's a set of crappy, laggy, slow, inefficient functions he made. I fixed them up MAJORLY so they would be better, they still suck however. In any case, they were uploaded to Utopia, and we contributed, so he may not use them on another server.

I'm sure he's using BlooTool, and all his other BlooServer crap.

Basically if it starts with Bloo, you know it's bad. ;)

EDIT:
POST 2,000 WOOOOOO!!!!!!!!!!!!

zokemon
04-13-2008, 05:47 PM
Basically if it starts with Bloo, you know it's bad. ;)

Haha. :)

Angel_Light
04-13-2008, 08:15 PM
Wow, I didn't know about the space after //#CLIENTSIDE thing. x.x That just fixed a butt load of my problems....