View Single Post
  #3  
Old 04-16-2011, 12:26 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Tip: You can center a GUI when it's created by setting it's X and Y like this:

PHP Code:
//#CLIENTSIDE
function center(guiObj) {
  
with (guiObj) {
    
= (screenwidth width) / 2;
    
= (screenheight height) / 2;
  }

In your case you could just change the X and Y lines with the ones I suggested above. The default coordinates you left (1050,100) when you were making it with the GUI Editor could cause it to be off the screen for people.

You can also use a for-each loop and catchevent to remove the redundant button code.

PHP Code:
// For-each Example
temp.servers = {
  
"Login",
  
"Graal Kingdoms",
  
"Zone",
  
"Zodiac",
  
"Era",
  
"Unholy Nations",
  
"Valikorlia",
  
"Maloria",
  
"AEON"
};
for (
temp.servertemp.servers) {
  new 
GuiButtonCtrl("ServerList_Button_" temp.server) { 
    
profile GuiRedButtonProfile
    
text temp.server
    
width 80
    
10;
    
10 + (40 temp.servers.index(temp.server);
    
thiso.catchevent(this"onAction""onServerWarp");
  }
}

// All your 'obj.onAction()' functions can then be replaced with just this:
function onServerWarp(obj) {
  
serverwarp(obj.text);

__________________
Quote:
Reply With Quote