Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Script errors (https://forums.graalonline.com/forums/showthread.php?t=79236)

bscharff 03-29-2008 10:13 PM

Script errors
 
I'm not sure why It's doing this...

NPC Code:

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


Here's the script
PHP Code:

function onCreated(){
  
join("bloofunctions");
  
setimg("angel_speaker.png");
  
setshape(13232);
  
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.intidthis.levelthis.xthis.y);
    }
    if (
command == "clear"){
      
findnpc("BlooIntercoms").sendMessage(this.intid"", (player.nick@" ("@player.account@")"));
    }
  }
}

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

function 
onTimeout(){
  if (
this.attr[2] != NULL && this.attr[2] != ""){ //Message
    
showtext(1x+0.5y-1"Arial""b"doParse(this.attr[2]));
    
changeimgzoom(10.5);
    
changeimgcolors(11110.9);
  }else{
    
hideimg(1);
  }
  if (
this.attr[3] != NULL && this.attr[3] != ""){ //From
    
showtext(2x+0.5y-2"Arial""b"doParse(this.attr[3]));
    
changeimgzoom(20.5);
    
changeimgcolors(21110.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,

PHP Code:

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:
PHP Code:

function onCreated(){
  
join("bloofunctions");
  
setimg("angel_speaker.png");
  
setshape(13232);
  
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.intidthis.levelthis.xthis.y);
    }
    if (
command == "clear"){
      
findnpc("BlooIntercoms").sendMessage(this.intid"", (player.nick@" ("@player.account@")"));
    }
  }
}

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

function 
onTimeout(){
  if (
this.attr[2] != NULL && this.attr[2] != ""){ //Message
    
showtext(1x+0.5y-1"Arial""b"doParse(this.attr[2]));
    
changeimgzoom(10.5);
    
changeimgcolors(11110.9);
  }else{
    
hideimg(1);
  }
  if (
this.attr[3] != NULL && this.attr[3] != ""){ //From
    
showtext(2x+0.5y-2"Arial""b"doParse(this.attr[3]));
    
changeimgzoom(20.5);
    
changeimgcolors(21110.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á

NPC Code:

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..

NPC Code:

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


Inverness 04-07-2008 04:01 AM

Quote:

Originally Posted by xXziroXx (Post 1384589)
I reccon this should do the trick for that line in question..

NPC Code:

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


PHP Code:

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:

PHP Code:

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


napo_p2p 04-07-2008 07:24 AM

Quote:

Originally Posted by cbkbud (Post 1384681)
Maybe something like this:

PHP Code:

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


Yucky! :P

Inver's would work just fine ;).

Inverness 04-07-2008 10:41 PM

Quote:

Originally Posted by cbkbud (Post 1384681)
Maybe something like this:

PHP Code:

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

Quote:

Originally Posted by cbkbud (Post 1384798)
What's yucky about it?

Compare mine to yours.

Chompy 04-08-2008 12:07 AM

PHP Code:

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

Quote:

Originally Posted by cbkbud (Post 1384813)
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
PHP Code:

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
*/ 

PHP Code:

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
*/ 

PHP Code:

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:

PHP Code:

function onCreated() {
  
temp.a_b = new TStaticVar();
  
temp.a_b."foo";
  
  
temp."_b";
  
  echo(
makevar("a"@b).c);
}
/*
foo
*/ 

while this doesn't
PHP Code:

function onCreated() {
  
temp.a_b = new TStaticVar();
  
temp.a_b.message "foo";
  
  
temp."_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

Quote:

Originally Posted by Inverness (Post 1384641)
PHP Code:

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

Quote:

Originally Posted by xXziroXx (Post 1384952)
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

Quote:

Originally Posted by xXziroXx (Post 1384952)
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

Quote:

Originally Posted by xXziroXx (Post 1384990)
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

Quote:

Originally Posted by zokemon (Post 1385037)
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

Quote:

Originally Posted by zokemon (Post 1385743)
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

Quote:

Originally Posted by zokemon (Post 1385743)
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

Quote:

Originally Posted by cbkbud (Post 1385776)
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....


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

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