Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   ShowText/Showpoly in joined classes (https://forums.graalonline.com/forums/showthread.php?t=68427)

JkWhoSaysNi 08-29-2006 05:52 PM

ShowText/Showpoly in joined classes
 
Hello, I'm trying to use showtext and showpoly from the class and it just wont work.

The class has //#CLIENTSIDE at the top so I assumed it would work and it's being joined to a clientside object. The error I get in the F2 window is:

Quote:

GraalScript: Function showtext not found in script of
Is it not possible to use showtext or showpoly from joined classes?

xXziroXx 08-29-2006 06:01 PM

Yes, it is. Mind showing us the script thats not working?

JkWhoSaysNi 08-29-2006 06:18 PM

I'm trying to make a mouseover class.

PHP Code:

//#CLIENTSIDE
public function onCreated() {
setTimer(1);
}
public function 
setToolTip(text) {
  
this.text text;
  
setTimer(1);
}

function 
onTimeout() {
  if (
mousescreenx-12 in |this.x,this.x+this.width*4| && mousescreeny-6 in |this.y,this.y+this.height*8|) {
    
showTooltip();
  }
  else {
   
hideimg(350);
  }
  
setTimer(1);
  
}

function 
showTooltip() {
  echo(
this.text); //shows correctly in F2 window on mouseover
  
showtext(3502020"Arial""b"this.text ).zoom 0.6//gives error in F2 window
  
changeimgvis(350,7);


Heres how I'm using it:
PHP Code:

findimg(i).join("mouseover");
findimg(i).setToolTip("test text"); 


xXziroXx 08-29-2006 08:09 PM

Uhh.. do this:

PHP Code:

showtext(3502020"Arial""b"this.text );
changeimgzoom(3500.6); 


JkWhoSaysNi 08-29-2006 09:03 PM

it's worked how i have it in other places. Just saves a line. But, removing .zoom() from the end doesn't solve the problem. F2 window still reports that the function cant be found.

Tolnaftate2004 08-29-2006 10:09 PM

There are ways to work around having to use showtext.
controlling script:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.imgs = new [5];
  
temp.texts = {
                 
"I am testing.",
                 
"No really, I am.",
                 
"C'mon! I seriously am!",
                 
"Why don't you believe me?",
                 
"Fine, be that way! :("
               
};
  
this.tlen this.imgs.size();
  for (
temp.i=0;temp.i<this.tlen;temp.i++) {
    
this.imgs[temp.i] = showtext(200+temp.i,20,20+14*temp.i,"Arial","",temp.texts[temp.i]);
    
this.imgs[temp.i].parent this;
    
with (this.imgs[temp.i]) {
      
this.layer 5;
      
this.zoom 12/23;
      
this.join("mouseover");
      
this.setToolTip("test text");
      
this.tooltip findimg(350+temp.i);
      
this.width gettextwidth(12/23,"","Arial",temp.texts[temp.i]);
      
this.height gettextheight(12/23,"","Arial");
    }
  }


mouseover class:
PHP Code:

//#CLIENTSIDE
public function setToolTip(text) {
  
this.tooltext text;
  
setTimer(0.05);
}
function 
onTimeout() {
  if (
mousescreenx in |this.x,this.x+this.width
    && 
mousescreeny in |this.y,this.y+this.height|) {
    
showTooltip();
  }
  elseif (
this.wait 0this.wait --;
  else {
    
thiso.tooltip.text "";
  }
  
setTimer(0.05);
}
function 
showTooltip() {
  for (
temp.i=0;temp.i<this.parent.tlen;temp.i++) {
    
this.parent.imgs[temp.i].wait 0;
    
this.parent.imgs[temp.i].tooltip.text "";
  }
  
this.wait 20;
  echo(
this.tooltext);
  
this.tooltip.zoom 12/23;
  
this.tooltip.layer 7;
  
this.tooltip.text this.tooltext;
  
this.tooltip.style "b";
  
this.tooltip.mousescreenx 14;
  
this.tooltip.mousescreeny 2;



JkWhoSaysNi 08-31-2006 03:05 PM

so are you saying showpoly/showtext cant be used the normal way from a joined class?

If theres not I can put the showtext/showpoly parts in the weapon NPC thats calling it. It'd just be nicer to have it in a class :)


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

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