Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Selection (https://forums.graalonline.com/forums/showthread.php?t=84248)

[email protected] 02-16-2009 07:23 PM

Selection
 
3 Attachment(s)
PHP Code:

//#CLIENTSIDE
function onMouseDown(key) {
  if (!(
key in {"left""right"})) return;
  
this.("on" key "Click")();
}

function 
onLeftClick() {
  
this.ns = {mousescreenxmousescreeny};
  
this.np = {mousexmousey};
  
setTimer(0.05);
}

function 
onRightClick() {
  if (
this.list == null) return true;
  
  
this.list = null;
  
this.onClearPeople();
}

function 
onTimeout() {
  if (!
mousebuttons) {
    
this.onSearch({mousexmousey});
    return;
  }
  
  
showpoly(200, {
    
this.ns[0], this.ns[1],
    
mousescreenxthis.ns[1],
    
mousescreenxmousescreeny,
    
this.ns[0], mousescreeny
  
});
  
changeimgvis(2004); 
  
changeimgcolors(2000000.4);
  
  
setTimer(0.05);
}

function 
onSearch(mp) {    
  
hideimg(200);
  
  
temp.this.np//origional mx/my
  
temp.= {mp[0] - c[0], mp[1] - c[1]};
  if (
p[0].starts("-")) {
    
temp.= {{mp[0], c[1]}, {c[0], mp[1]}};
    if (
p[1].starts("-")) {
      
temp.= {mpc};
    }
  } else {
    
temp.= {cmp};
    if (
p[1].starts("-")) {
      
temp.= {{c[0], mp[1]}, {mp[0], c[1]}};
    }
  }
  
  
temp.pl findnearestplayers(s[0][0], s[0][1]);
  for (
temp.ppl) {
    if (!(
p.x in |s[0][0], s[1][0]|)) continue;
    if (!(
p.y in |s[0][1], s[1][1]|)) continue;
    
temp.list.add(p);
  }
  if (
temp.list == null) return;
  
this.list = temp.list;
  
  
this.onDisplayPeople();
}

function 
onDisplayPeople() {
  
this.onClearPeople();
    
  
temp.pos = {0100};
  
temp.ext = {150, (32 this.list.size())};
  
with (findimg(201)) {
    
polygon = {pos[0], pos[1], 
               
pos[0] + ext[0], pos[1],
               
pos[0] + ext[0], pos[1] + ext[1],
               
pos[0], pos[1] + ext[1]};
    
layer 4;  
    
mode 2;
    
alpha 0.5;
  }
  
  for (
temp.pthis.list) {
    
temp.ypos = (pos[1] + ((thiso.imgcount 1) * 32));
      
//Head
    
with(findimg(201 this.imgcount)) {
      
image p.headimg
      
pos[0];
      
ypos;
      
layer 5;
      
partw 32parth 32partx 0party 64;
    }
      
//Account
    
with(findimg(206 this.imgcount)) {
      
text p.nick.substring(017); 
      
pos[0] + 35;
      
ypos;
      
zoom 0.6;
      
layer 5;
    }
      
//HP&MP
    
for (temp.0temp.2temp.i++) {
      
with(findimg((211 + (1) * 6) + + this.imgcount)) {
        
image "c_gui-bar" ".png";
        
layer 5;
        
pos[0] + 35;
        
ypos 14 + (8);
      }
    } 
    
this.imgcount++;
    if (
this.imgcount 5) break;
  }
}

function 
onClearPeople() {
  
hideimgs(200225 this.imgcount);
  
this.imgcount 1;


It's similar to C&C game selection, but it works for players! I was originally going to make a staff system with it, but as an example this one shows the selected players health points on the left hand side. It's quite fun ^^

Rufus 02-16-2009 07:27 PM

Probably best to keep it reserved for left clicking, else you're selecting and checking a profile when you right click. Looks nice.

[email protected] 02-16-2009 07:31 PM

Right click clears the list [people already selected].

Rufus 02-16-2009 07:49 PM

Quote:

Originally Posted by [email protected] (Post 1466991)
Right click clears the list [people already selected].

Oh, I only read the first few lines and assumed. Silly me because it clearly says that a few lines down :noob:

Rave_J 10-23-2009 06:58 AM

hmm i upload it on testbed to c if it works and it wouldnt work for me idk why
i try left clicking myself and right click it and nothing hmm can someone tell me why

TSAdmin 10-23-2009 09:54 AM

Quote:

Originally Posted by Rave_J (Post 1533381)
hmm i upload it on testbed to c if it works and it wouldnt work for me idk why
i try left clicking myself and right click it and nothing hmm can someone tell me why

I only browsed through the script for indicators that'd make it work for the user, but I'm pretty sure it's not meant for selecting yourself. It looks like it's meant only for selecting others.

Dependant on the uses someone puts it toward, selecting ones self wouldn't even be necessary anyway.

[email protected] 10-23-2009 06:04 PM

Works fine for me- you can select yourself aswell.
You may need to delete the '//#CLIENTSIDE ' space at the end of that line, I had a problem with copying and pasting because of the tiny space there.

Rave_J 10-23-2009 07:55 PM

ya thats it thanks
looks neat but not for me :)
well back to learning more about gs scripting hopefully i can be good as you and tsa

Pelikano 10-24-2009 10:00 AM

Quote:

Originally Posted by Rave_J (Post 1533513)
ya thats it thanks
looks neat but not for me :)
well back to learning more about gs scripting hopefully i can be good as you and tsa

You do know that TSA just TOTALLY failed?

TSAdmin 10-25-2009 11:54 AM

Quote:

Originally Posted by Pelikano (Post 1533620)
You do know that TSA just TOTALLY failed?

How?

Quote:

Originally Posted by TSAdmin (Post 1533405)
I only browsed through the script for indicators that'd make it work for the user


Pelikano 10-25-2009 12:09 PM

Quote:

Originally Posted by TSAdmin (Post 1533405)
but I'm pretty sure it's not meant for selecting yourself.

o_O


All times are GMT +2. The time now is 07:24 AM.

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