Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-11-2007, 05:21 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
moving gui

HTML Code:
function onCreated() {
  this.join("sys_gfxdraw");
}
//#CLIENTSIDE
function onCreated() {
  h = this;
  
  this.mainGui();
  this.updateHP();
  this.updateMP();
}
function mainGui() {
  this.gData = {c.wid("arca_hud-base.png"), c.hei("arca_hud-base.png")};
    // ^ public function [getimgwidth, getimgheight]
  if (client.hud_pos == null) {
    client.hud_pos = {c.center(this.gData[0])[0], screenheight};
    // ^ public function [gets position of the screen center]
  }  
  this.mainImg();
}

function mainImg() {
  this.dImg({200, "arca_hud-base.png", {client.hud_pos[0], (client.hud_pos[1] - 25)}, 4});
}

function onMouseDown(click) {
  if (temp.click != "left") {
    return false;
  }
  if (c.mx(client.hud_pos[0], client.hud_pos[0] + this.gData[0]) && c.my(client.hud_pos[1] - this.gData[1], client.hud_pos[1] + 25)) {
    //public function ^ [mousescreenx, mousescreeny]
    scheduleevent(0.05, "Move", "");
  }
}

function onMove() {
  if (mousebuttons > 0) {
    client.hud_pos = {(mousescreenx - (this.gData[0] / 2)), mousescreeny};

    this.mainImg();
    this.updateHP();
    this.updateMP();
    
    scheduleevent(0.05, "Move", "");
  }
}

public function updateHP() {
  this.dImg({201, "arca_hud-greenbar.png", {(client.hud_pos[0] + 1), (client.hud_pos[1] - 7)}, 5});
}

public function updateMP() {
  this.dImg({202, "arca_hud-bluebar.png", {(client.hud_pos[0] + 116), (client.hud_pos[1] - 7)}, 5});
}
Here's the class [sys_gfxdraw]
HTML Code:
//#CLIENTSIDE
function dImg(img) {
  showimg(temp.img[0], temp.img[1], temp.img[2][0], temp.img[2][1]);
  changeimgvis(temp.img[0], temp.img[3]);
  changeimgmode(temp.img[0], 1);
}
Here's what it looks like on graal [You can move it around!]
Attached Thumbnails
Click image for larger version

Name:	gGui.png
Views:	392
Size:	8.6 KB
ID:	43046  
__________________
Reply With Quote
  #2  
Old 10-13-2007, 07:38 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Nice script.

But, isn't it a bit better to use a GuiShowImgCtrl and set canmove to true?
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 10-13-2007, 09:07 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
hmm probably
alot more people use showimg, so I decided to do it that way. [to show how it can be done]
__________________
Reply With Quote
  #4  
Old 10-13-2007, 05:51 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I think that's starting to change...I can't see why people wouldn't use GUI Controls for that, it's so easy.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
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 10:39 PM.


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