Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Very awesome staff "panel" (https://forums.graalonline.com/forums/showthread.php?t=134262776)

Crow 07-25-2011 11:15 AM

Quote:

Originally Posted by fatcat123 (Post 1660207)
How do I give GraalControl focus?

It has focus by default. You know that it has focus when you can walk around using your arrow keys (or whatever you use to move).

fatcat123 08-03-2011 05:01 PM

Quote:

Originally Posted by Crow (Post 1660249)
It has focus by default. You know that it has focus when you can walk around using your arrow keys (or whatever you use to move).

The tool runs just fine, but when you activate it, you cannot scroll. It'll only stay on exit. When you create another staff tool, it'll scroll to the first and second one, but not the third. Also, the second one will keep on lighting up as if it's chosen.

Crow 08-03-2011 05:08 PM

Quote:

Originally Posted by fatcat123 (Post 1661470)
The tool runs just fine, but when you activate it, you cannot scroll. It'll only stay on exit. When you create another staff tool, it'll scroll to the first and second one, but not the third. Also, the second one will keep on lighting up as if it's chosen.

:oo:

Edit: Only thing I can think of is a broken toolEntries array. What does yours look like?

ff7chocoboknight 08-03-2011 06:35 PM

So it works, but it doesn't work?

fatcat123 08-04-2011 03:44 AM

Log onto the server "Dev iKiDD". I added you it so you can see it for yourself.

Crow 08-04-2011 11:35 AM

Quote:

Originally Posted by fatcat123 (Post 1661569)
Log onto the server "Dev iKiDD". I added you it so you can see it for yourself.

Again, I suspect a broken array:

Quote:

Originally Posted by Crow (Post 1661471)
Edit: Only thing I can think of is a broken toolEntries array. What does yours look like?

Show me yours, please.

Edit: Nevermind. I ****ed up one of the lines, not even sure how I managed to do that. Line 79:
PHP Code:

this.toolIdx %= this.toolEntries.size() - 1

Needs to be replaced with this instead:
PHP Code:

this.toolIdx %= this.toolEntries.size(); 



Editē: Full code, fixed:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
// staff tool stuff
  
this.toolOn false;
  
this.toolIdx 0;
  
  
// add new items here
  
this.toolEntries = {
    { 
"Exit""block.png" },
    { 
"Update Level""block.png" }
  };
}

// 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 104this.toolEntries.size() * 4064);
    
with (findImg(200)) {
      
polygon temp.p;
      
red green blue 0;
      
alpha 0.75mode 1;
      
layer 5;
    }
    
    
// text
    
with (findImg(201)) {
      
temp.8;
      
GraalControl.height 58;
      
text thiso.toolEntries[thiso.toolIdx][0];
      
font "Arial"zoom 0.5;
      
red green blue 1;
      
layer 6;
    }
    
    
// 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.5mode 1;
        
layer 6;
      }
    }
  }
  
  
// update text & alpha
  
findImg(201).text this.toolEntries[this.toolIdx][0];
  
  
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 == 69) { // E
    
if (!this.toolOn) {
      
this.toolOn  true;
      
this.toolIdx 0;
      
      
DrawTool(true);
    } else {
      
this.toolIdx++;
      
this.toolIdx %= this.toolEntries.size();

      
DrawTool(false);
    }
  } elseif (
code == 87) { // W
    
if (!this.toolOn)
      return;
    
    
temp.ReplaceText(this.toolEntries[this.toolIdx][0].upper(), " ""_");
    (
"StaffTool" temp.f)();
  }
}


// close staff tool
function StaffToolEXIT() {
  
this.toolOn false;
  
hideImgs(200201 this.toolEntries.size());
}

// 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 { 
xywywhx}; 

If a mod would be so kind and edit the first post with this.

fatcat123 08-04-2011 05:05 PM

Quote:

Originally Posted by Crow (Post 1661664)
Again, I suspect a broken array:



Show me yours, please.

Edit: Nevermind. I ****ed up one of the lines, not even sure how I managed to do that. Line 79:
PHP Code:

this.toolIdx %= this.toolEntries.size() - 1

Needs to be replaced with this instead:
PHP Code:

this.toolIdx %= this.toolEntries.size(); 



Editē: Full code, fixed:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
// staff tool stuff
  
this.toolOn false;
  
this.toolIdx 0;
  
  
// add new items here
  
this.toolEntries = {
    { 
"Exit""block.png" },
    { 
"Update Level""block.png" }
  };
}

// 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 104this.toolEntries.size() * 4064);
    
with (findImg(200)) {
      
polygon temp.p;
      
red green blue 0;
      
alpha 0.75mode 1;
      
layer 5;
    }
    
    
// text
    
with (findImg(201)) {
      
temp.8;
      
GraalControl.height 58;
      
text thiso.toolEntries[thiso.toolIdx][0];
      
font "Arial"zoom 0.5;
      
red green blue 1;
      
layer 6;
    }
    
    
// 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.5mode 1;
        
layer 6;
      }
    }
  }
  
  
// update text & alpha
  
findImg(201).text this.toolEntries[this.toolIdx][0];
  
  
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 == 69) { // E
    
if (!this.toolOn) {
      
this.toolOn  true;
      
this.toolIdx 0;
      
      
DrawTool(true);
    } else {
      
this.toolIdx++;
      
this.toolIdx %= this.toolEntries.size();

      
DrawTool(false);
    }
  } elseif (
code == 87) { // W
    
if (!this.toolOn)
      return;
    
    
temp.ReplaceText(this.toolEntries[this.toolIdx][0].upper(), " ""_");
    (
"StaffTool" temp.f)();
  }
}


// close staff tool
function StaffToolEXIT() {
  
this.toolOn false;
  
hideImgs(200201 this.toolEntries.size());
}

// 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 { 
xywywhx}; 

If a mod would be so kind and edit the first post with this.

The tool won't even work now =S
Never mind. You forgot to remove the space by //@CLIENTSIDE

cbk1994 08-04-2011 05:29 PM

Quote:

Originally Posted by fatcat123 (Post 1661724)
The tool won't even work now =S
Never mind. You forgot to remove the space by //@CLIENTSIDE

No he didn't. The forums add spaces after every line in scripts.

Crow 08-04-2011 05:39 PM

Quote:

Originally Posted by cbk1994 (Post 1661726)
No he didn't. The forums add spaces after every line in scripts.

Aye.

Emera 08-10-2011 11:56 AM

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); 



Crow 08-10-2011 12:20 PM

Quote:

Originally Posted by Emera (Post 1662855)
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.

I already did that a while ago a couple posts above, and you removed the exit entry, which makes this whole tool a bit stupid.

irock1 09-07-2011 02:30 PM

Not working d:

Crow 09-07-2011 02:37 PM

Quote:

Originally Posted by irock1 (Post 1667313)
Not working d:

Did you use this code snippet?

iGraalian 07-18-2015 01:00 PM

Does this staff panel still work?
I tried it on my server and it seems to not be functional.

Crow 07-18-2015 01:45 PM

Pretty sure it still does, yup.


All times are GMT +2. The time now is 07:37 PM.

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