Graal Forums

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

Samposse 11-30-2009 04:38 PM

GUI Problem ...
 
:\
i got this problem
(nothing in he GUI show's :S

the script was found in code gallery http://forums.graalonline.com/forums...64#post1541364

and i thinnk that its not working becous i hawnt Fixed this jet (//Replace the £ with the percentage sign)

but i hawnt done that becous i dont even know what percentage sign is x_x

so can someone help me



here's the script that's in the link above (its images in the link that was used in script ...

---------------------------------------------------------------------------------------------

PHP Code:

//#CLIENTSIDE
function onCreated() {
    
//How many bars there are... [in order]
  
if (client.hud_barsactive == null) {
    
client.hud_barsorder = {"hp", "armor", "weapon", "money", "time"};
    
client.hud_barsactive = {1, 1, 1, 1, 1};
    
client.inv_trans = 1;
  }
  
this.onDisplay();
}

function 
onDisplay() {
  
temp.ix = 5;
  
temp.iy = 5;
  
  
hideimgs(200, 300);
  
this.buttons = {};
  for (
temp.i = 0; temp.i < client.hud_barsorder.size(); temp.i++) {   
    
temp.active = getRowByID(i);
    
    
temp.img = showimg(201 + i, "era_gui_line2.png", ix, iy + (i * 16));
    
temp.img.layer = 4;
    
temp.img.partx = 0; temp.img.party = 0;
    
temp.img.partw = (active? 112: 13); temp.img.parth = 16;
    
temp.img.alpha = 1;    

    if (
active) {
      
this.("onDraw" @ getNameByID(i))({ix, iy + (i * 16)});
      
this.buttons.add({i, {ix + 12, iy + (i * 16)}, {112, 12}, "row"}); 
    }
    
    
temp.text = (active? "-":"+");
    
temp.img = showtext(210 + i, ix + 4, iy + (i * 16), "Arial", "b", temp.text);
    
temp.img.layer = 4;
    
temp.img.zoom = (active? 0.75:0.7);
    
    
this.buttons.add({i, {ix, iy + (i * 16)}, {16, 16}});
  }
}

function 
drawBars(bar) {
  
temp.img = showimg(bar[0], "era_gui_hpbars.png", bar[1][0], bar[1][1]);
  
temp.img.layer = 5;
  
temp.img.partw = 66; temp.img.parth = 10; 
  
  
temp.img = showimg(bar[0] + 1, "era_gui_hpbars.png", bar[1][0], bar[1][1]);
  
temp.img.layer = 6;
  
temp.img.partw = bar[2][0]; temp.img.parth = 10;
  
temp.img.party = bar[2][1];
}

function 
onDrawHP(pos) {
  
temp.img = showtext(230, temp.pos[0] + 43, temp.pos[1] + 1, "Arial", "b", "HP:" @ max(0, clientr.hp) @ "/" @ clientr.hpmax);
  
temp.img.layer = 7; temp.img.zoom = 0.6;
  
temp.img.alpha = 0.6;

  
temp.img = showimg(231, "era_gui_symbols.png", temp.pos[0] + 15, temp.pos[1] + 1); 
  
temp.img.layer = 6;  temp.img.partx = (level.nopkzone? 16: 0);
  
temp.img.partw = 16; temp.img.parth = 16;
 
  
this.drawBars({232, {pos[0] + 35, pos[1] + 3}, {max(1, roundTo((clientr.hp / clientr.hpmax) * 66, 10)), 10}});
}

function 
onDrawArmor(pos) {
  
temp.img = showtext(240, temp.pos[0] + 43, temp.pos[1] + 1, "Arial", "b", "Armor:" @ max(0, clientr.armor) @ "/" @ max(0, clientr.armormax));
  
temp.img.layer = 7; temp.img.zoom = 0.6;
  
temp.img.alpha = 0.6;

  
temp.img = showimg(241, "era_gui_symbols.png", temp.pos[0] + 15, temp.pos[1] + 1); 
  
temp.img.layer = 26;  temp.img.partx = 32;
  
temp.img.partw = 16; temp.img.parth = 16;

  
this.drawBars({242, {pos[0] + 35, pos[1] + 3}, {max(1, roundTo((clientr.armor / clientr.armormax) * 66, 10)), 40}});
}

function 
onDrawMoney(pos) {
  
temp.img = showtext(250, temp.pos[0] + 43, temp.pos[1] + 1, "Arial", "b", "$" @ player.rupees);
  
temp.img.layer = 7; temp.img.zoom = 0.6;
  
temp.img.alpha = 0.6;

  
temp.img = showimg(251, "era_gui_symbols.png", temp.pos[0] + 15, temp.pos[1] + 1); 
  
temp.img.layer = 26;  temp.img.partx = 64;
  
temp.img.partw = 16; temp.img.parth = 16;
}

function 
onDrawTime(pos) {
  if (!
getRowByName("time")) return false;

  
temp.cHours = int(hours);
  if (
cHours >= 12) cHours -= 12;
  if (
cHours == 0) cHours = 12;

  
//Replace the £ with the percentage sign
  
temp.cTime = int(cHours / 10) @ int(cHours £ 10) @ ":" @ int(mins / 10) @ int(mins £ 10);
  
  
cTime = cTime SPC (hours >= 12? "PM":"AM");

  
temp.img = showtext(260, temp.pos[0] + 43, temp.pos[1] + 1, "Arial", "b", cTime);
  
temp.img.layer = 7; temp.img.zoom = 0.6;
  
temp.img.alpha = 0.6;

  
temp.img = showimg(261, "era_gui_symbols.png", temp.pos[0] + 15, temp.pos[1] + 1); 
  
temp.img.layer = 26;  temp.img.partx = 48;
  
temp.img.partw = 16; temp.img.parth = 16;
  
  
cancelevents("DrawTime");
  
scheduleevent(3, "DrawTime", {temp.pos});
}

function 
onDrawWeapon(pos) {
  
temp.img = showimg(270, "era_gui_symbols.png", temp.pos[0] + 15, temp.pos[1] + 1); 
  
temp.img.layer = 26;  temp.img.partx = 80;
  
temp.img.partw = 16; temp.img.parth = 16;
}

function 
onMouseDown(click) {
  if (!(
temp.click in {"right", "left"})) return false;
  
  
temp.m = {mousescreenx, mousescreeny};
  for (
temp.i: this.buttons) {
    if (
m[0] in |i[1][0], i[1][0] + i[2][0]| && m[1] in |i[1][1], i[1][1] + i[2][1]|) {
      if (
click == "right") {
        
client.inv_trans -= 0.2;
        if (
client.inv_trans < 0) client.inv_trans = 1; 
        
this.onDisplay();
        break;
      }
      if (
i[3] == null) {
        
this.onToggleRow(i[0]);
        
this.onDisplay();
        break;
      } else {
        if (
mousebuttons > 0) {
          
this.data = i;
          
setTimer(0.05);
        }
      }
    }
  }
}

function 
onTimeout() {
  
temp.i = this.data;
  if (
mousescreeny in |i[1][1] + i[2][1], i[1][1] + (i[2][1] * 2)|) {
    if (
i[0] == (client.hud_barsorder.size() - 1)) return false;
            
    
temp.index = client.hud_barsorder.index(getNameByID(i[0]));
    
temp.data = client.hud_barsorder[temp.index + 1];
            
    
temp.copy = client.hud_barsorder;
    
temp.copy.replace(index, data);
    
temp.copy.replace(index + 1, getNameByID(i[0]));
    
client.hud_barsorder = temp.copy;
            
    
this.data = {i[0] + 1, {i[1][0], i[1][1] + 16}, {112, 12}, "row"};
    
this.onDisplay();
  }
   else 
  if (
mousescreeny in |i[1][1] - (i[2][1] + 12), i[1][1] - i[2][1]|) {
    if (
i[0] == 0) return false;
            
    
temp.index = client.hud_barsorder.index(getNameByID(i[0]));
    
temp.data = client.hud_barsorder[temp.index-1];
           
    
temp.copy = client.hud_barsorder;
    
temp.copy.replace(index, data);
    
temp.copy.replace(index - 1, getNameByID(i[0]));
    
client.hud_barsorder = temp.copy;

    
this.data = {i[0] - 1, {i[1][0], i[1][1] - 16}, {112, 12}, "row"};            
    
this.onDisplay();
  }
  if (
mousebuttons > 0) setTimer(0.05);
}

function 
onToggleRow(flag) {
  
client.hud_barsactive[temp.flag] = !client.hud_barsactive[temp.flag];
}

function 
getRowByName(flag) {
  return 
client.hud_barsactive[client.hud_barsorder.index(temp.flag)];
}

function 
getRowByID(flag) {
  return 
client.hud_barsactive[temp.flag];
}

function 
getNameByID(flag) {
  return 
client.hud_barsorder[temp.flag];
}

function 
roundTo(val, place) {
  return 
int(temp.val / temp.place + 0.5) * temp.place;
}

function 
onUpdateVariable(temp.varName) {
  if (!(
varName in {"hp", "hpmax", "armor", "armormax"}))
    return 
false;
    
  
this.onCreated();
} 



help plz :cry:

Samposse 11-30-2009 04:40 PM

i will Make my own Image's for this Script if this Scrip works ! :)

fowlplay4 11-30-2009 04:52 PM

1 Attachment(s)
See attached for the percent sign.

I really wish they would get rid of that protection, and just keep the forum software up to date.. or provide a bbcode or something.

Samposse 11-30-2009 05:47 PM

Thanks ! :)
it works ! :D


All times are GMT +2. The time now is 01:14 AM.

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