View Single Post
  #40  
Old 08-10-2011, 11:56 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I fixed that problem where is misses out the last staff tool and also added a functional description system in there too. I thought it was a nice touch. Here is is.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
// staff tool stuff 
  
this.toolOn false;
  
this.toolIdx 0;
  
// add new items here 
  
this.toolEntries = {
    {
"Update Level""bush.png""Updates the current level."},
  };
}
// draw the staff tool 

function DrawTool(create) {
  
// create image objects 
  
if (create) {
    
// background 
    
temp.GraalControl.width this.toolEntries.size() * 20;
    
temp.GetPolyRect(temp.xGraalControl.height 119this.toolEntries.size() * 4089);
    
with(findImg(200)) {
      
polygon temp.p;
      
red green blue 1;
      
alpha 0.75;
      
mode 1;
      
border true;
      
layer 5;
    }
    
// text 
    
with(findImg(201)) {
      
temp.8;
      
GraalControl.height 58;
      
text thiso.toolEntries[thiso.toolIdx][2];
      
font "Arial";
      
zoom 0.5;
      
red green blue 0;
      
layer 6;
      
style "b";
    }
    
//desc
    
with(findImg(212)) {
      
temp.8;
      
GraalControl.height 48;
      
text thiso.toolEntries[thiso.toolIdx][3];
      
font "Arial";
      
zoom 0.5;
      
red green blue 0;
      
layer 6;
      
style "b";
    }
    
//title
    
with(findImg(213)) {
      
temp.70;
      
GraalControl.height 115;
      
text "Staff Panel - " servername;
      
font "Arial";
      
zoom 0.5;
      
red green blue 0;
      
layer 6;
      
style "b";
      if (
mouseover) {
        
say2 lol;
      }
    }
    
// icons 
    
for (temp.0this.toolEntries.size(); i++) {
      
with(findImg(202 i)) {
        
temp.40;
        
GraalControl.height 96;
        
image thiso.toolEntries[i][1];
        
partx party 0;
        
partw parth 32;
        
alpha 0.5;
        
mode 1;
        
layer 6;
      }
    }
  }
  
// update text & alpha 
  
findImg(201).text this.toolEntries[this.toolIdx][0];
  
findimg(212).text this.toolEntries[this.toolIdx][2];
  
temp.ci this.toolIdx// current tool 
  
temp.li = (ci ci this.toolEntries.size() - 1); // last tool 
  
findImg(202 ci).alpha 1;
  
findImg(202 li).alpha 0.5;
}
// reposition the staff tool when resizing Graal 

function GraalControl.onResize(nwnh) {
  if (!
this.toolOn) return;
  
DrawTool(true);
}
// keyboard stuff 

function GraalControl.onKeyDown(code) {
  if (
code == 219) { // [
    
if (!this.toolOn) {
      
this.toolOn true;
      
this.toolIdx 0;
      
DrawTool(true);
    } else {
      
this.toolIdx++;
      
this.toolIdx %= this.toolEntries.size();
      
DrawTool(false);
    }
  }
  elseif(
code == 221) { // ]
    
if (!this.toolOn) return;
    
temp.ReplaceText(this.toolEntries[this.toolIdx][0].upper(), " ""_");
    (
"StaffTool" temp.f)();
  }
}
// update level 

function StaffToolUPDATE_LEVEL() {
  
shared.chat("");
  
sleep(0.05);
  
shared.chat("update level");
}
// Dusty's, restyled 

function ReplaceText(txtab) {
  if (
txt.pos(a) < 0) return txt;
  
temp.len a.length();
  
temp.txtpos txt.positions(a);
  
temp.newtxt txt.substring(0txtpos[0]);
  for (
temp.itemp.txtpos) {
    
temp.txt.substring(temp.len).pos(a);
    
temp.newtxt @= b;
    
temp.newtxt @= txt.substring(temp.lentemp.p);
  }
  return 
temp.newtxt;
}
// Crow's :3 

function GetPolyRect(xywh)
return {
  
xywywhxh
};
  function 
onPlayerDies() { 
  if (
this.toolOn
    
DrawTool(true); 

__________________
Reply With Quote