Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
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
 


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 05:21 PM.


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