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 02-16-2009, 07:23 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Selection

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
Attached Thumbnails
Click image for larger version

Name:	conttrol.jpg
Views:	272
Size:	14.5 KB
ID:	47442  
Attached Images
  
Reply With Quote
  #2  
Old 02-16-2009, 07:27 PM
Rufus Rufus is offline
Registered User
Join Date: Jun 2004
Location: United Kingdom
Posts: 4,698
Rufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud of
Probably best to keep it reserved for left clicking, else you're selecting and checking a profile when you right click. Looks nice.
__________________
Quote:
Originally Posted by Loriel View Post
Seriously, you have ****-all for content and you're not exactly pulling in new developer talent, angling for prestigious titles should be your last concern.
Reply With Quote
  #3  
Old 02-16-2009, 07:31 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Right click clears the list [people already selected].
Reply With Quote
  #4  
Old 02-16-2009, 07:49 PM
Rufus Rufus is offline
Registered User
Join Date: Jun 2004
Location: United Kingdom
Posts: 4,698
Rufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud ofRufus has much to be proud of
Quote:
Originally Posted by [email protected] View Post
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
__________________
Quote:
Originally Posted by Loriel View Post
Seriously, you have ****-all for content and you're not exactly pulling in new developer talent, angling for prestigious titles should be your last concern.
Reply With Quote
  #5  
Old 10-23-2009, 06:58 AM
Rave_J Rave_J is offline
Graal Developer
Join Date: Feb 2006
Location: Texas
Posts: 848
Rave_J can only hope to improve
Send a message via AIM to Rave_J Send a message via MSN to Rave_J Send a message via Yahoo to Rave_J
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
Reply With Quote
  #6  
Old 10-23-2009, 09:54 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to behold
Quote:
Originally Posted by Rave_J View Post
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.
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #7  
Old 10-23-2009, 06:04 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
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.
Reply With Quote
  #8  
Old 10-23-2009, 07:55 PM
Rave_J Rave_J is offline
Graal Developer
Join Date: Feb 2006
Location: Texas
Posts: 848
Rave_J can only hope to improve
Send a message via AIM to Rave_J Send a message via MSN to Rave_J Send a message via Yahoo to Rave_J
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
Reply With Quote
  #9  
Old 10-24-2009, 10:00 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by Rave_J View Post
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?
Reply With Quote
  #10  
Old 10-25-2009, 11:54 AM
TSAdmin TSAdmin is offline
Forum Moderator
TSAdmin's Avatar
Join Date: Aug 2006
Location: Australia
Posts: 1,980
TSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to beholdTSAdmin is a splendid one to behold
Quote:
Originally Posted by Pelikano View Post
You do know that TSA just TOTALLY failed?
How?

Quote:
Originally Posted by TSAdmin View Post
I only browsed through the script for indicators that'd make it work for the user
__________________
TSAdmin (Forum Moderator)
Welcome to the Official GraalOnline Forums! Where sharing an opinion may be seen as a declaration of war!
------------------------
· User Agreement · Code of Conduct · Forum Rules ·
· Graal Support · Administrative Contacts ·
Reply With Quote
  #11  
Old 10-25-2009, 12:09 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by TSAdmin View Post
but I'm pretty sure it's not meant for selecting yourself.
o_O
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 08:01 PM.


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