Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-09-2011, 04:40 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Problem With Right Click Gui

Basically im trying to make a menu for when you right click players.
it all works except when you click open profile its seems to select the wrong player. this is the part of the script thats producing the error.
if someone could please take a look at it it would be appriciated.
its somthing to do with findNearestPlayers(mousex, mousey)
also is there a way to make the scroll grey without making the text grey?

PHP Code:
function onSelectRow() {
  for (
temp.plfindNearestPlayers(mousexmousey)) {
    
temp.selected Right_Click_List.getSelectedText();
    
GraalControl.makeFirstResponder(true);
    if (
temp.selected == "Profile") {
      
findPlayer(temp.pl).showprofile();
    }
    
Right_Click_List.hide();
    
Right_Click_Scroll.hide();
  }

__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion

Last edited by Gunderak; 09-09-2011 at 04:56 PM..
Reply With Quote
  #2  
Old 09-09-2011, 06:09 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by Gunderak View Post
PHP Code:
function onSelectRow() {
  for (
temp.plfindNearestPlayers(mousexmousey)) {
    
temp.selected Right_Click_List.getSelectedText();
    
GraalControl.makeFirstResponder(true);
    if (
temp.selected == "Profile") {
      
findPlayer(temp.pl).showprofile();
    }
    
Right_Click_List.hide();
    
Right_Click_Scroll.hide();
  }

You are looping through the entire array of what findnearestplayers returns, but you could just read the first player in the array.
PHP Code:
//set to nearest player to mousex, mousey
temp.pl findnearestplayers(mousexmousey)[0];
//if the player is not near the click, return...
if (vectordist({mousexmousey0}, {pl.1.5pl.20}) > 2)
  return; 
Quote:
Originally Posted by Gunderak View Post
also is there a way to make the scroll grey without making the text grey?
PHP Code:
with (GuiScrollCtrl) {
  
useownprofile true;
  
profile.bitmap "myscrollbitmap.png";

The default guiblue scroll bitmap is guiblue_scroll.png.

So, you can just edit it to create your own.
__________________

Last edited by 0PiX0; 09-09-2011 at 06:23 PM..
Reply With Quote
  #3  
Old 09-09-2011, 09:51 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Gunderak View Post
PHP Code:
function onSelectRow() {
  for (
temp.plfindNearestPlayers(mousexmousey)) {
    
temp.selected Right_Click_List.getSelectedText();
    
GraalControl.makeFirstResponder(true);
    if (
temp.selected == "Profile") {
      
findPlayer(temp.pl).showprofile();
    }
    
Right_Click_List.hide();
    
Right_Click_Scroll.hide();
  }

PHP Code:
findPlayer(temp.pl).showprofile(); 
is incorrect. temp.pl, in this case, is already a player object.

PHP Code:
temp.pl.showProfile(); 
is all you need.

The former will probably work, though. The issue that's preventing it from working is that you're not checking if the player is actually at the mouse coordinates.
__________________
Reply With Quote
  #4  
Old 09-10-2011, 04:08 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
i was doing a check before hand in the script but i didnt post that part because i didnt think it was neccesary seeming there were no errors with the opening of the gui.
@0PIX0 and @cbk1994 but is there any way to change the selected row colour? the box is now grey but when you click one it selects as blue.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #5  
Old 09-10-2011, 05:07 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
You should learn about GuiControlProfiles.
PHP Code:
//sets the highlight background color to green
profile.fillcolorhl = {02550255}; 
__________________
Reply With Quote
  #6  
Old 09-14-2011, 11:08 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Thanks @0PiX0 iv managed to do it with your help.
I never knew such a command existed.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
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 03:04 PM.


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