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 07-13-2010, 05:21 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
Gui TextEdit and PopUp

They wont let me select anything in PopUp, and TextEdit wont actually edit anything at all.

Do GUI's HAVE to be part of a Gui_Window? Was trying to get certain things to show up inside something else and didnt really want a window (showing over a image instead).
__________________
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
  #2  
Old 07-13-2010, 06:06 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
No, they don't have to be in a window. Show your code.
__________________
Reply With Quote
  #3  
Old 07-13-2010, 06:14 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
It was some Tailor that was in the code gallery a while ago. Was simply going to transfer the guts to something else I'm doing. Seems that if i select something from the popup window, it goes to the text edit, but I still cant text edit either.
PHP Code:
function onActionServerSide( cmd, var )
{
  if ( 
cmd == "setShield" )
  {
    
player.shieldimg = var;  
  }
  if ( 
cmd == "setHead" )
  {
    
player.headimg = var;  
  }
}
//#CLIENTSIDE
function displayTailor() {
  new 
GuiShowImgCtrl( "Tailor_Doll" )
    {
      
x = this.displayXY[0] + 490;
      
y = this.displayXY[1] + 160;
      
transparency = this.invAlpha;
      
ani = "armageddon-idle";
      
temp.parts = { "headimg", "shield", "bodyimg" };
      for ( 
temp.a: temp.parts )
      {
        
actor.( @ temp.a ) = player.( @ temp.a );
      }
      for ( 
temp.i = 0; temp.i < 6; temp.i ++ )
      {
        
actor.colors[temp.i] = player.colors[temp.i];
      }
      
actor.attr[3] = player.attr[3];
    }
    
temp.left_parts = { { "Head", "headimg", "headimg" }, { "Body", "bodyimg", "bodyimg" }, { "Shield", "shield", "shieldimg" } };
    for ( 
temp.i = 0; temp.i <  temp.left_parts.size(); temp.i++ )
    {
      new 
GuiTextCtrl( "Tailor_" @ temp.left_parts[temp.i][0] @ "_Text" )
      {
        
profile = Armageddon_Text;
        
x = 495;
        
y = 205 + ( temp.i * 25 );
        
transparency = this.invAlpha;
        
useownprofile = true;
        
profile.fontstyle = "bold";
        
text =  temp.left_parts[temp.i][0] @ ":";
      }
      new 
GuiTextEditCtrl( "Tailor_" @ temp.left_parts[temp.i][0] @ "_Edit" )
      {
        
profile = Armageddon_TextEdit;
        
x = 540;
        
y = 205 + ( temp.i * 25 );
        
height = 20;
        
width = 50;
        
useownprofile = true;
        
transparency = this.invAlpha;
        
profile.fontstyle = "bold";
        
this.var = temp.left_parts[temp.i][1];
        
text = player.( @ temp.left_parts[temp.i][1] );
        
thiso.catchevent( name, "onTextChanged", "onTailorFill" );
      }
    }
    
temp.colors = {
    
"white",
    
"yellow",
    
"orange",
    
"pink",
    
"red",
    
"darkred",
    
"lightgreen",
    
"green",
    
"darkgreen",
    
"lightblue",
    
"blue",
    
"darkblue",
    
"brown",
    
"cynober",
    
"purple",
    
"darkpurple",
    
"lightgray",
    
"gray",
    
"black",
    
"transparent"
    
};
    
temp.parts = {
    
"Skin",
    
"Coat",
    
"Sleeves",
    
"Shoes",
    
"Belt"
    
};
    
temp.player_colors = {
    
player.colors[0],
    
player.colors[1],
    
player.colors[2],
    
player.colors[3],
    
player.colors[4]
    };
    for ( 
temp.i = 0; temp.i < temp.parts.size(); temp.i ++ )
    {
      new 
GuiTextCtrl( "Tailor_Text_" @ temp.parts[temp.i] )
      {
        
profile = Armageddon_Text;
        
x = 595;
        
y = 155 + ( 25 * temp.i );
        
useownprofile = true;
        
profile.fontstyle = "bold";
        
transparency = this.invAlpha;
        
text = temp.parts[temp.i] @ ":";
      }
      new 
GuiPopUpMenuCtrl( "Tailor_PopUp_" @ temp.parts[temp.i] )
      {
        
profile = Armageddon_Scroll;
        
textprofile = Armageddon_TextList;
        
scrollprofile = Armageddon_Scroll;
        
x = 640;
        
y = 155 + ( 25 * temp.i );
        
width = 50;
        
height = 20;
        
transparency = this.invAlpha;
        
clearRows();
        
this.var = temp.i;
        for ( 
temp.a: temp.colors )
        {
          
addRow( 0, temp.a );
        }
        
setSelectedRow( temp.player_colors[temp.i] );
        
thiso.catchevent( name, "onSelect", "onTailorColors" );
      }
    }
    new 
GuiButtonCtrl( "Tailor_Accept" )
    {
      
profile = Armageddon_Button;
      
x = 560;
      
y = 170;
      
height = 20;
      
width = 30;
      
text = "Ok";
      
transparency = this.invAlpha;
    }
    new 
GuiButtonCtrl( "Tailor_Save" )
    {
      
profile = Armageddon_Button;
      
x = 530;
      
y = 150;
      
height = 20;
      
width = 30;
      
text = "Save";
      
transparency = this.invAlpha;
    }
    new 
GuiButtonCtrl( "Tailor_Load" )
    {
      
profile = Armageddon_Button;
      
x = 560;
      
y = 150;
      
height = 20;
      
width = 30;
      
text = "Load";
      
transparency = this.invAlpha;
    }
}
function 
Tailor_Save.onAction()
{
  if ( 
client.outfits.size() < 9 )
  {
    
showSave();
  }
  else
  {
    
player.chat = "You already have 9 outfits, delete some!";
  }
}
function 
Tailor_Doll.onMouseDown()
{
  
button = "left";
  if ( 
button == "left" )
  {
    if ( 
Tailor_Doll.dir < 3 )
    {
      
Tailor_Doll.dir ++;
    }
    else
    {
      
Tailor_Doll.dir = 0;
    }
  }
  else if ( 
button == "right" )
  {
    if ( 
Tailor_Doll.dir > 0 )
    {
      
Tailor_Doll.dir --;
    }
    else
    {
      
Tailor_Doll.dir = 3;
    }
  }
}
function 
Tailor_Load.onAction()
{
  if ( 
client.outfits.size() != -1 )
  {
    
showLoad();
  }
  else
  {
    
player.chat = "You do not have any outfits!";
  }
}
function 
showSave()
{
  
TailorSave_Window.destroy();
  
TailorLoad_Window.destroy();
  new 
GuiWindowCtrl( "TailorSave_Window" )
  {
   
//shows save gui window, works fine
}
function 
showLoad()
{
 
//shows load gui window, works fine
}
function 
TailorLoad_Delete.onAction()
{
  var = 
TailorLoad_List.getselectedtext();
  
client.outfits.delete( client.outfits.index( var ) );
  
player.chat = "Outfit" SPC var SPC "deleted!";
  
showLoad();
}
function 
TailorLoad_List.onSelect( blah, outfit )
{
  var = 
client.( @ "outfit_" @ outfit );
  
TailorLoad_Doll.actor.headimg = var[0];
  
TailorLoad_Doll.actor.bodyimg = var[1];
  
TailorLoad_Doll.actor.shield = var[2];
  for ( 
temp.i = 0; temp.i < 6; temp.i ++ )
  {
    
TailorLoad_Doll.actor.colors[temp.i] = var[3 + temp.i];
  }
}
function 
TailorLoad_Load.onAction()
{
  
// Head, Body, Shield, colors[0], colors[1], colors[2], colors[3], colors[4]
  
triggerserver( "gui", name, "setHead", client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[0] );
  
triggerserver( "gui", name, "setShield", client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[2] );
  
player.bodyimg = client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[1];
  for ( 
temp.i = 0; temp.i < 5; temp.i ++ )
  {
    
player.colors[temp.i] = client.( @ "outfit_" @ TailorLoad_List.getselectedtext() )[3 + temp.i];
  }
  
player.chat = "Outfit" SPC TailorLoad_List.getselectedtext() SPC "loaded!";
  
TailorLoad_Window.destroy();
}
function 
TailorSave_Button.onAction()
{
  if ( 
client.outfits.index( TailorSave_Name.text  ) == -1 )
  {
    
client.outfits.add( TailorSave_Name.text );
    
client.( @ "outfit_" @ TailorSave_Name.text ) = { TailorSave_Doll.actor.headimg, TailorSave_Doll.actor.bodyimg, 

TailorSave_Doll.actor.shield, TailorSave_Doll.actor.colors[0], TailorSave_Doll.actor.colors[1], 

TailorSave_Doll.actor.colors[2], TailorSave_Doll.actor.colors[3], TailorSave_Doll.actor.colors[4] };
    
// Head, Body, Shield, colors[0], colors[1], colors[2], colors[3], colors[4]
    
player.chat = "Outfit" SPC TailorSave_Name.text SPC "saved!";
    
TailorSave_Window.destroy();
  }
  else
  {
    
player.chat = "That outfit name is already taken!";
  }
}
function 
Tailor_Accept.onAction()
{
  
player.bodyimg = Tailor_Doll.actor.bodyimg;
  
triggerserver( "gui", name, "setHead", Tailor_Doll.actor.head );
  
triggerserver( "gui", name, "setShield", Tailor_Doll.actor.shield );
  for ( 
temp.a = 0; temp.a < 5; temp.a ++ )
  {
    
player.colors[temp.a] = Tailor_Doll.actor.colors[temp.a];
  }
  
Tailor_Window.destroy();
  
TailorSave_Window.destroy();
}
function 
onTailorColors()
{
  
temp.var = ( params[0] ).var;
  
Tailor_Doll.actor.colors[temp.var] = params[3];
}
function 
onTailorFill()
{
  
Tailor_Doll.actor.( @ params[0].( "var" ) ) = params[1];
} 
__________________
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
  #4  
Old 07-13-2010, 11:09 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
Maybe I should just work it as buttons with images? But then how would I do the PopUps? I dont see anything wrong with this code whatsoever.
__________________
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
  #5  
Old 07-14-2010, 12:30 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
I remember working on one of my first GUI systems. It was pretty convoluted. I had to keep adding stuff and things kept breaking. One of the most frustrating problems it seems, was actually caused by a mispasted block of code. I ended scanning my script many many times for misplaced braces/brackets/whatever (these things: {} ). A few days of messing around with them finally yielded a working script.

Also I recently found out that if theres a space after //#CLIENTSIDE, itll totally wreck the script. it seems like you have a space next to it in what you posted, but that may just be the forum's PHP script. just make sure there isnt a space there.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #6  
Old 07-14-2010, 04:45 AM
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
Quote:
Originally Posted by Jiroxys7 View Post
I remember working on one of my first GUI systems. It was pretty convoluted. I had to keep adding stuff and things kept breaking. One of the most frustrating problems it seems, was actually caused by a mispasted block of code. I ended scanning my script many many times for misplaced braces/brackets/whatever (these things: {} ). A few days of messing around with them finally yielded a working script.

Also I recently found out that if theres a space after //#CLIENTSIDE, itll totally wreck the script. it seems like you have a space next to it in what you posted, but that may just be the forum's PHP script. just make sure there isnt a space there.
No space after clientside, just double checked. I know I COULD have missed something, but im 99.9% sure the exact same guts that make Tailor work as a wnpc are in this wnpc as well, which is just weird that it wouldnt work.
__________________
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 07-14-2010, 05:40 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
My guess would be that it has something to do with your event handling.

try catching one of the events like:

PHP Code:
function Tailor_PopUp_Skin.onSelect(rowid, rowtext) {
  echo(
"Works!");
} 
If that works, try changing
PHP Code:
thiso.catchevent(name, ...); 
to
PHP Code:
thiso.catchevent(this, ...); 
(sending the object as the parameter, instead of a string -- that's what I normally do, but it could just cast the object to a string when I do it...dunno)

edit: also, transparency = this.invAlpha; should be transparency = thiso.invAlpha; (unrelated, but I thought I might point it out)
__________________
Reply With Quote
  #8  
Old 07-17-2010, 05:54 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
Quote:
Originally Posted by salesman View Post
My guess would be that it has something to do with your event handling.

try catching one of the events like:

PHP Code:
function Tailor_PopUp_Skin.onSelect(rowid, rowtext) {
  echo(
"Works!");
} 
Wont even get that far. Its hard to explain, but the popup menu will drop, but it wont even highlight what my mouse is over after it has dropped, much less select what I click.

Also, thanks for thiso.var.
__________________
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 07-17-2010, 06:33 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
Found the issue. My script uses a timeout to show up images, needs it for the keycheck. So it was constantly calling the show up for the tailor, which was constantly setting the selected rows, which was then constantly look for it, and would do nothing. Put a scheduleevent somewhere else to call that function, and fixed it.
__________________
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
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 09:20 PM.


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