Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Problem With Right Click Gui (https://forums.graalonline.com/forums/showthread.php?t=134264516)

Gunderak 09-09-2011 04:40 PM

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



0PiX0 09-09-2011 06:09 PM

Quote:

Originally Posted by Gunderak (Post 1667575)
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 (Post 1667575)
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.
http://img8.imageshack.us/img8/9549/guibluescroll.png
So, you can just edit it to create your own.

cbk1994 09-09-2011 09:51 PM

Quote:

Originally Posted by Gunderak (Post 1667575)
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.

Gunderak 09-10-2011 04:08 AM

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.

0PiX0 09-10-2011 05:07 AM

You should learn about GuiControlProfiles.
PHP Code:

//sets the highlight background color to green
profile.fillcolorhl = {02550255}; 


Gunderak 09-14-2011 11:08 AM

Thanks @0PiX0 iv managed to do it with your help.
I never knew such a command existed.


All times are GMT +2. The time now is 09:56 PM.

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