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-03-2013, 08:25 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
While using a GUI Control is ideal for stuff related to clicking, with normal displays you could try something such as this:

PHP Code:
//#CLIENTSIDE
function showHUD(){
  
this.addHUDObj(this.showimg(200"image.png"xy), 32324);

  
this.addHUDObj(this.showimg(201"image2.png"xy), 64644);

  
temp.this.showtext(202xy"tempus sans itc""b""text");
  
temp.t.zoom 0.5;
  
temp.gettextwidth(temp.t.zoomtemp.t.fonttemp.t.styletemp.t.text);
  
temp.gettextheight(temp.t.zoomtemp.t.fonttemp.t.styletemp.t.text);
  
this.addHUDObj(temp.ttemp.wtemp.h5);
}

function 
addHUDObj(temp.displaytemp.wtemp.htemp.layer){
  
temp.display.dwidth temp.w;
  
temp.display.dheight temp.h;
  
temp.display.layer temp.layer;
  
this.displays.add(temp.display);
}

function 
onMouseDown(temp.button) {
  if(
temp.button != "left")
    return;

  for(
temp.this.displays){
    if(
      
mousescreenx in <temp.d.xtemp.d.temp.d.dwidth> &&
      
mousescreeny in <temp.d.ytemp.d.temp.d.dheight>
    ){
      
this.startDrag(temp.d);
      return;
    }
  }
}

function 
startDrag(temp.d){
  
this.dragobj temp.d;
  
this.draglayer this.dragobj.layer;
  
this.draglayer 6;
  
this.dragoffx mousescreenx this.dragobj.x;
  
this.dragoffy mousescreeny this.dragobj.y;
  
this.scheduleEvent(0.05"Drag""");
}

function 
onDrag(){
  if(!
leftmousebutton){
    
this.dragobj.layer this.draglayer;
    return;
  }
  
this.dragobj.min(max(0mousescreenx this.dragoffx), screenwidth this.dragobj.dwidth);
  
this.dragobj.min(max(0mousescreeny this.dragoffy), screenheight this.dragobj.dheight);
  
this.scheduleEvent(0.05"Drag""");


Last edited by ffcmike; 01-03-2013 at 08:38 PM..
Reply With Quote
  #2  
Old 01-03-2013, 08:58 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by ffcmike View Post
While using a GUI Control is ideal for stuff related to clicking, with normal displays you could try something such as this:

PHP Code:
if(
      
mousescreenx in <temp.d.xtemp.d.temp.d.dwidth> &&
      
mousescreeny in <temp.d.ytemp.d.temp.d.dheight>
    ) 
wouldnt it have to be like the following?
PHP Code:
if(
  
mousescreenx in |temp.d.xtemp.d.temp.d.dwidth| &&
  
mousescreeny in |temp.d.ytemp.d.temp.d.dheight|

if not, what would the < > 's do exactly in this case (i know that they can be used for smaller, bigger checks but wouldnt make sense in here like i am used to it)?
__________________
MEEP!
Reply With Quote
  #3  
Old 01-03-2013, 09:03 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by callimuc View Post
wouldnt it have to be like the following?
PHP Code:
if(
  
mousescreenx in |temp.d.xtemp.d.temp.d.dwidth| &&
  
mousescreeny in |temp.d.ytemp.d.temp.d.dheight|

if not, what would the < > 's do exactly in this case (i know that they can be used for smaller, bigger checks but wouldnt make sense in here like i am used to it)?
Using |,| includes the minimum and maximum value, allowing an edge-on intersect, whereas with <,> it has to be within the range. It doesn't matter so much in this case.
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:23 PM.


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