Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-29-2008, 10:13 PM
bscharff bscharff is offline
Bloo
bscharff's Avatar
Join Date: Sep 2006
Location: San Antonio, Texas
Posts: 185
bscharff has a little shameless behaviour in the past
Send a message via AIM to bscharff Send a message via MSN to bscharff Send a message via Yahoo to bscharff
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!
__________________
Trying to be nice now...
Reply With Quote
  #2  
Old 03-29-2008, 10:58 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
You have a space after //#CLIENTSIDE
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 03-29-2008, 11:00 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #4  
Old 04-06-2008, 04:08 AM
bscharff bscharff is offline
Bloo
bscharff's Avatar
Join Date: Sep 2006
Location: San Antonio, Texas
Posts: 185
bscharff has a little shameless behaviour in the past
Send a message via AIM to bscharff Send a message via MSN to bscharff Send a message via Yahoo to bscharff
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);

__________________
Trying to be nice now...
Reply With Quote
  #5  
Old 04-06-2008, 04:25 AM
Imperialistic Imperialistic is offline
graal player lord
Imperialistic's Avatar
Join Date: Apr 2007
Location: Florida
Posts: 1,094
Imperialistic is a jewel in the roughImperialistic is a jewel in the rough
A space can do that I believe. Believe it or not, spacebar is actually a hidden character, somewhat.
__________________
" It's been swell, but the swelling's gone down. "
Reply With Quote
  #6  
Old 04-06-2008, 05:15 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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
__________________
Reply With Quote
  #7  
Old 04-06-2008, 01:04 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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
__________________
Reply With Quote
  #8  
Old 04-06-2008, 02:43 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Silly little error

And what server is this for?
__________________
Reply With Quote
  #9  
Old 04-06-2008, 08:12 PM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
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
__________________
Reply With Quote
  #10  
Old 04-06-2008, 08:30 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I just noticed that, DO NOT USE A TIMEOUT ON SERVERSIDE.
__________________
Reply With Quote
  #11  
Old 04-07-2008, 12:38 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Once again, what server is this for?
__________________
Reply With Quote
  #12  
Old 04-07-2008, 12:53 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
I reccon this should do the trick for that line in question..

NPC Code:

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

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #13  
Old 04-07-2008, 04:01 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by xXziroXx View Post
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().
__________________
Reply With Quote
  #14  
Old 04-07-2008, 04:50 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Maybe something like this:

PHP Code:
this.attr[2] = findnpc("BlooIntercoms").(@this.intid).( @ "message" ); 
__________________
Reply With Quote
  #15  
Old 04-07-2008, 07:24 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by cbkbud View Post
Maybe something like this:

PHP Code:
this.attr[2] = findnpc("BlooIntercoms").(@this.intid).( @ "message" ); 
Yucky! :P

Inver's would work just fine .
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:20 AM.


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