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 01-22-2007, 07:42 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
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.
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #2  
Old 01-22-2007, 07:51 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Use a loop and x/y of mouse?
Reply With Quote
  #3  
Old 01-22-2007, 08:00 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
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);

Reply With Quote
  #4  
Old 01-22-2007, 10:08 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Cheers Twinny! :]

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

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #5  
Old 01-22-2007, 10:11 AM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Twinny, what's showimg(201, blah); do?
__________________
Reply With Quote
  #6  
Old 01-22-2007, 10:21 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
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.
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #7  
Old 01-22-2007, 01:38 PM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
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?
__________________
Save Classic!
Reply With Quote
  #8  
Old 01-22-2007, 02:34 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
It must be clientside yes, and the showimg() parameters must be specified (imgindex, image, x, y)
Reply With Quote
  #9  
Old 01-22-2007, 06:38 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Looks like i'll need to fiddle around with this.

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

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #10  
Old 01-22-2007, 09:35 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
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.
Reply With Quote
  #11  
Old 01-22-2007, 11:33 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I was thinking this.width/this.height since it's set with showcharacter(); and i think when you set an image or use setshape();.
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 03:45 PM.


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