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 10-12-2013, 05:09 AM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Help with GUI?

So I'm having trouble with this inventory I'm creating. I'm basically trying to make it so when a player right clicks an item within the inventory, a Context GUIctrl will appear for displaying/clicking options. Well I've got this to work perfectly fine.. Except I can't click any of the options because oddly one of these other GUI's isn't allowing it and won't let the Context GUIctrl grab focus/activity.

I've tried doing a million different things regarding all the different GUI's, like making the other windows lose focus/activity, disabling the other gui's modal and than enabling only the options menu's modal, but alas.. nothing.

I was hoping one of you mighty fine scriptin' fellas' would be able to locate the problem a let me know because I can't find anything and it's preventing me from completing the code.

Thanks in advance, Sage! ^_^

I've attached the pieces of the code pertaining to the problem in a link here:

http://pastebin.com/bwW8e2Ma

Edit: Sorry for having to post a link rather than directly posting the code in the thread. Oddly my browser isn't letting me post it here.. it's saying something about "Owner denied your request".. Something to do with the tags around the code I think.. Not completely sure though. -_-
Reply With Quote
  #2  
Old 10-12-2013, 10:29 AM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 354
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
hello!

i couldnt replicate this problem when using the provided script without all the server specific stuff, the item options menu appeared and functioned as expected, so i think this is interfering with another script

although this wont fix the problem a word of advice is that guis and profiles are not strings, they are objects so shouldnt really be in " " quotes

good luck!
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #3  
Old 10-12-2013, 11:41 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Debug using the following- it will tell you which GUI is stealing focus- press F2 to see the output;

HTML Code:
//#CLIENTSIDE
function onFirstResponderChanges(obj) {
   echo(format(_("Stealing Focus: %s at %f %f"), temp.obj.name, temp.obj.x, temp.obj.y));
}
__________________
Reply With Quote
  #4  
Old 10-12-2013, 02:20 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Quote:
Originally Posted by xAndrewx View Post
Debug using the following- it will tell you which GUI is stealing focus- press F2 to see the output;

HTML Code:
//#CLIENTSIDE
function onFirstResponderChanges(obj) {
   echo(format(_("Stealing Focus: %s at %f %f"), temp.obj.name, temp.obj.x, temp.obj.y));
}
Thanks for the input Andrew, but I've actually already done this. Oddly the return is nullified. I'm not sure what's going on here. o_O
Reply With Quote
  #5  
Old 10-13-2013, 11:05 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
So after more research.. I've found that the ContextMenuCtrl, is actually just not registering as an object. I put the GUI in it's own code and was wondering if anyone could point out the problem? Btw the debug is returning null in all aspects.. I have a feeling it's something extremely simple that I'm just overlooking.. Or perhaps it's a problem with Graal in itself?

HTML Code:
//#CLIENTSIDE
function onCreated() { 
  onDisplayOptions();
}

function onDisplayOptions() {
  new GuiContextMenuCtrl("Options_Menu") {
    profile = "Necro_TextEdit";
    profile.modal = true;
    profile.active = true;
    profile.makefirstresponder = true;
    textprofile = "Necro_Text";
    text = "Options";
    width = 20;
    
    clearRows();
    bringtofront();
    isfirstresponder();
    
    addRow(0, "Options"); 
    addrow(-1, "-"); 
    for (temp.I = 0; temp.I < thiso.options.size(); temp.I++) 
    { 
      addRow(temp.I + 1, thiso.options[temp.I]); 
    } 
     
    open(mousescreenx, mousescreeny); 
  }
}

function onFirstResponderChanges(obj) {
  player.chat = "Debug2:"SPC temp.obj.name SPC temp.obj.x SPC temp.obj.y;
}
Edit: I actually changed the player chat return to an echo, and it's actually echoing the name of the object now? But seemingly incorrect x/y coordinates, as they're returning null? Anyone have any idea what's going on here? haha
Reply With Quote
  #6  
Old 10-13-2013, 11:19 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
I had to call to destroy() every time before showing/creating the menu ctrl on our old one, maybe that will help as hacky as it is?

Also, unless you have other windows using modal or firstresponder, at least through all my gui stuff I've done, all you should really need is bringtofront() for these types of things (unless some other reason besides just showing up front).

Also, in your posted code, line 198:
PHP Code:
function Options_Menu.onSelect(entryidtext)  {
  
temp.slot this.cell_selected;
 
  if (
temp.slot <= this.items.size()) {
    
play("necro_click2.wav");
    
temp.itemName makevar("clientr.items"thiso.backpack)[slot];
    
temp.itemRealName makevar("clientr.item_"temp.itemName)[1];
    if ( 
temp.itemName == NULL ) {
      if ( 
isObject("ItemOptions_Menu") )
        
ItemOptions_Menu.destroy();
      return;
    }
  } 
Should that be function ItemOptions_Menu?

Hopefully one of those helps.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #7  
Old 10-13-2013, 11:29 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Quote:
Originally Posted by sssssssssss View Post
I had to call to destroy() every time before showing/creating the menu ctrl on our old one, maybe that will help as hacky as it is?

Also, unless you have other windows using modal or firstresponder, at least through all my gui stuff I've done, all you should really need is bringtofront() for these types of things (unless some other reason besides just showing up front).

Also, in your posted code, line 198:
PHP Code:
function Options_Menu.onSelect(entryidtext)  {
  
temp.slot this.cell_selected;
 
  if (
temp.slot <= this.items.size()) {
    
play("necro_click2.wav");
    
temp.itemName makevar("clientr.items"thiso.backpack)[slot];
    
temp.itemRealName makevar("clientr.item_"temp.itemName)[1];
    if ( 
temp.itemName == NULL ) {
      if ( 
isObject("ItemOptions_Menu") )
        
ItemOptions_Menu.destroy();
      return;
    }
  } 
Should that be function ItemOptions_Menu?

Hopefully one of those helps.
Yeah I already do destroy everytime before showing (Pretty sure you're supposed to? Correct me if I'm wrong, but that's what I've learned through experience.)

And yeah I am using modal on other GUI's so they don't immediately interfere with gameplay. As far as the firstresponder thing.. I added that as the aftermath of not being able to correctly focus the context menu, just for testing purposes to see if it would help the problem (Which obviously isn't the case now.)

And thanks for pointing out the typo. Would've noticed it eventually once I got the GUI correctly functioning, but good gesture either way.

But yeah.. none of those really help what I'm trying to accomplish here. Not sure if my last post serves any relevance to the problem, but I think it should.. and I'm not at all sure how to fix it. -_-
Reply With Quote
  #8  
Old 10-13-2013, 11:38 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
PHP Code:
new GuiContextMenuCtrl("Options_Menu") {
    
profile "Necro_TextEdit";

    
textprofile "Necro_Text";
    
text "Options";
    
width 20;
    
    
clearRows();
    
bringtofront();
    
    
addRow(0"Options"); 
    
addrow(-1"-"); 
    for (
temp.0temp.thiso.options.size(); temp.I++) 
    { 
      
addRow(temp.1thiso.options[temp.I]); 
    } 
     
    
open(mousescreenxmousescreeny); 
  }
}

function 
Options_Menu.onSelect(entryidtext)  {
  
player.chat text;

Above worked just fine for me.
Quote:
Except I can't click any of the options because oddly one of these other GUI's isn't allowing it and won't let the Context GUIctrl grab focus/activity.
If that typo was what you were using that would stop it from doing anything because it wasnt reading the right gui obj name for the selection.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #9  
Old 10-13-2013, 11:58 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Quote:
Originally Posted by sssssssssss View Post
PHP Code:
new GuiContextMenuCtrl("Options_Menu") {
    
profile "Necro_TextEdit";

    
textprofile "Necro_Text";
    
text "Options";
    
width 20;
    
    
clearRows();
    
bringtofront();
    
    
addRow(0"Options"); 
    
addrow(-1"-"); 
    for (
temp.0temp.thiso.options.size(); temp.I++) 
    { 
      
addRow(temp.1thiso.options[temp.I]); 
    } 
     
    
open(mousescreenxmousescreeny); 
  }
}

function 
Options_Menu.onSelect(entryidtext)  {
  
player.chat text;

Above worked just fine for me.


If that typo was what you were using that would stop it from doing anything because it wasnt reading the right gui obj name for the selection.
Hm, yeah I dunno what I was thinking. The above script DOES work fine.. so obviously this must have something to do with an interference from one of the other GUI's involved. I'm just not sure what's interfering or how.. And the typo isn't the problem. The context menu isn't correctly focusing for me to even click an option. For instance, the GUI will open and normally when mousing over an option it'll highlight the option you have moused over. This is the case when I have the Context menu in it's own script, but not the case when it's within the inventory code. It will only appear and allow me to close it.. but not highlight/select anything.
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:20 PM.


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