Graal Forums

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

Raeiphon 01-22-2007 07:42 AM

Mouseovers?
 
This frustrates me. How would I check if a player has his/her mouse over an npc? And if that check is true, display a text/function/whatever until they remove their mouse from over the class?

Like what Zodiac has for player nicks, but on NPC's.

excaliber7388 01-22-2007 07:51 AM

Use a loop and x/y of mouse?

Twinny 01-22-2007 08:00 AM

Something like this

PHP Code:

function onCreated()
  
setTimer(0.05);

function 
onTimeout()
{
  
this.over false;
  if (
mousex in |this.xthis.x+this.width|)
  {
    if (
mousey in |this.ythis.y+this.height|)
    {
      
this.over true;
    }
  }
   
  if (
this.over)
    
showimg(201blah);
  else
    
hideimg(201);

   
setTimer(0.05);



Raeiphon 01-22-2007 10:08 AM

Cheers Twinny! :]

I presume that's clientside? It doesn't appear to be working for me.

Crono 01-22-2007 10:11 AM

Twinny, what's showimg(201, blah); do?

Raeiphon 01-22-2007 10:21 AM

It's just a reference as to where to put whatever I want shown when the mouse is over.

Although, clientsided or none, it doesn't appear to be working at all for me.

maximus_asinus 01-22-2007 01:38 PM

Did you specify values for this.x and this.y and the height/width variables? I am not too familiar with GScript, but this seems like it could be an issue?

Admins 01-22-2007 02:34 PM

It must be clientside yes, and the showimg() parameters must be specified (imgindex, image, x, y)

Raeiphon 01-22-2007 06:38 PM

Looks like i'll need to fiddle around with this.

Would sticking a triggerclient in a timeout cause lag at all?

Chandler 01-22-2007 09:35 PM

HTML Code:

function onCreated()
{
  this.mouseWidth = 5;
  this.mouseHeight = 5; 
  this.mouseText = "Welcome to cHANDLER";
  this.onTimeout();
}

function onTimeout()
{
  if (mousex in |this.x, (this.x + this.mouseWidth)| && mousey in |this.y, (this.y +this.mouseHeight)|)
  {
    temp.mouseOver = true;
  }
 
  if (temp.mouseOver) 
  {
    /*
    triggerclient("weapon", "weaponName", "mouseAction", this.mouseText);
    function onActionClientside(curOption, curText)
    {
      if (temp.curOption == "mouseAction") 
      {
    */
        showtext(201, this.x, this.y, "Arial", "bc", this.mouseText); 
        changeimgvis(201, 2); 
    /*
      }
        else
      if (temp.curOption == "hideText") 
      {
        hideimg(201);
      }
    }
    */
  }
    else
  {
    hideimg(201); 
    /*
      triggerclient("weapon", "weaponName", "hideText");
    */
  }
  setTimer(0.05);
}

Also, Raeiphon, I'd use something like that, I'd carry the ''message'' over to and then something to stop it.

Twinny 01-22-2007 11:33 PM

I was thinking this.width/this.height since it's set with showcharacter(); and i think when you set an image or use setshape();.


All times are GMT +2. The time now is 02:49 AM.

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