Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Login Message (https://forums.graalonline.com/forums/showthread.php?t=77694)

cbk1994 11-25-2007 02:48 AM

Login Message
 
1 Attachment(s)
Here's the login message that is used on Utopia. I'm releasing it to the public, since it's not getting too much use here.

The files are control/serverNews.txt, control/serverHirings.txt, control/serverStaff.txt, and control/serverInfo.txt. Change these files to change what text shows up when you log on.

Script of Weapon/GUI-Script -System/LoginMessage:
PHP Code:

function onActionServerSidecmd )
{
  if ( 
cmd == "getMessage" )
  {
    
temp.n.loadLines"control/serverNews.txt" );
    
temp.h.loadLines"control/serverHirings.txt" );
    
temp.s.loadLines"control/serverStaff.txt" );
    
temp.i.loadLines"control/serverInfo.txt" );
    
triggerclient"gui"name"returnMessage"temp.ntemp.htemp.stemp.);
  }
}
//#CLIENTSIDE
function onCreated()
{
  
triggerserver"gui"name"getMessage" );
}
function 
onActionClientSidecmdnhs)
{
  if ( 
cmd == "returnMessage" )
  {
    for ( 
temp.)
    {
      
temp.ne @= temp."\n";
    }
    
    for ( 
temp.)
    {
      
temp.hi @= temp."\n";
    }
    
    for ( 
temp.)
    {
      
temp.st @= temp."\n";
    }
    
    for ( 
temp.)
    {
      
temp.inf @= temp."\n";
    }
    
    
showMessagetemp.netemp.hitemp.sttemp.inf );
  }
}
function 
showMessagenewshiringsstaffinfo )
{
  new 
GuiWindowCtrl"LoginMessage_Window" )
  {
    
profile "GuiBlueWindowProfile";
    
    
width 440;
    
height 368;
    
    
screenwidth - ( width );
    
screenheight - ( height );
    
    
canMaximize canResize false;
    
canClose canMinimize visible title true;
    
    
text "Welcome to" SPC servername "!";
    
    new 
GuiScrollCtrl"LoginMessage_NewsScroll" )
    {
      
profile "GuiBlueScrollProfile";
      
      
15;
      
54;
      
      
width 410;
      
height 300;
      
      
vScrollBar "dynamic";
      
hScrollBar "alwaysOff";
      
      
visible false;
      
      new 
GuiMLTextCtrl"LoginMessage_NewsText" )
      {
        
profile "GuiBlueTextProfile";
        
        
3;
        
0;
        
        
width 390;
        
height 300;
        
        
text news;
      }
    }
    
    new 
GuiScrollCtrl"LoginMessage_HiringsScroll" )
    {
      
profile "GuiBlueScrollProfile";
      
      
15;
      
54;
      
      
width 410;
      
height 300;
      
      
vScrollBar "dynamic";
      
hScrollBar "alwaysOff";
      
      
visible false;
      
      new 
GuiMLTextCtrl"LoginMessage_HiringsText" )
      {
        
profile "GuiBlueTextProfile";
        
        
3;
        
0;
        
        
width 390;
        
height 300;
        
        
text hirings;
      }
    }
    
    new 
GuiScrollCtrl"LoginMessage_StaffScroll" )
    {
      
profile "GuiBlueScrollProfile";
      
      
15;
      
54;
      
      
width 410;
      
height 300;
      
      
vScrollBar "dynamic";
      
hScrollBar "alwaysOff";
      
      
visible false;
      
      new 
GuiMLTextCtrl"LoginMessage_StaffText" )
      {
        
profile "GuiBlueTextProfile";
        
        
3;
        
0;
        
        
width 390;
        
height 300;
        
        
text staff;
      }
    }
    
    new 
GuiScrollCtrl"LoginMessage_InfoScroll" )
    {
      
profile "GuiBlueScrollProfile";
      
      
15;
      
54;
      
      
width 410;
      
height 300;
      
      
vScrollBar "dynamic";
      
hScrollBar "alwaysOff";
      
      
visible false;
      
      new 
GuiMLTextCtrl"LoginMessage_InfoText" )
      {
        
profile "GuiBlueTextProfile";
        
        
3;
        
0;
        
        
width 390;
        
height 300;
        
        
text info;
      }
    }
    new 
GuiTabCtrl"LoginMessage_Tab" )
    {
      
profile "GuiBlueTabProfile";
      
      
35;
      
30;
      
      
width 450;
      
height 24;
      
      
tabwidth 90;
      
      
clearRows();
      
      
temp.= {
                 { 
"News""LoginMessage_NewsScroll" },
                 { 
"Hirings""LoginMessage_HiringsScroll" },
                 { 
"Staff""LoginMessage_StaffScroll" },
                 { 
"Info""LoginMessage_InfoScroll" }
               };
      
      for ( 
temp.temp.)
      {
        
with addRow0temp.a[0] ) )
        {
          
this.iPane temp.a[1];
        }
      }
      
thiso.catcheventname"onSelect""onTabSelected" );
      
setSelectedRow);
    }
  }
}
function 
onTabSelectedtabs )
{
  for ( 
temp.tabs.rows )
  {
    if ( 
temp.== tabs.selected )
    {
      ( @ 
temp.t.iPane[0] ).visible true;
    }
    else
    {
      ( @ 
temp.t.iPane[0] ).visible false;
    }
  }


Attached are some screenshots. Please give me feedback! :)

foxboi 11-26-2007 04:42 AM

how is this GUI activated?

cbk1994 11-26-2007 05:18 AM

When you login, it will open.
Otherwise, I suppose you could map it so a key would open it, or a specific chat. Tell me if you need help with that!

EDIT:
Also, I forgot to point out that you'll need to add these rights to (npcserver)

r control/*.txt

so that it can read the files.

foxboi 11-26-2007 02:51 PM

It would be awesome if you could post a onKeyPressed or onPlayerChat function for it.

Codein 11-26-2007 03:30 PM

Quote:

Originally Posted by foxboi (Post 1360488)
It would be awesome if you could post a onKeyPressed or onPlayerChat function for it.

If you look at other scripts and Gscript guides, I suppose you could learn to implement it yourself. It's actually quite logical.

foxboi 11-27-2007 12:14 AM

Ah.kk

cbk1994 11-29-2007 01:56 AM

Add either of these below the //#CLIENTSIDE.

for chat
PHP Code:

function onPlayerChats()
{
  if ( 
player.chat == "/menu" )
  {
    
triggerserver"gui"name"getMessage" );
  }


and for a button

PHP Code:

function onKeyPressedcodekey )
{
  if ( 
key == "w" )
  {
    
triggerserver"gui"name"getMessage" );
  }


Tell me if you need any help with this!

Knightmare1 12-15-2007 07:29 PM

its till not working for me :(

pokeSMOT 02-07-2008 09:42 PM

For this type of code, do you just create a blank "weapon" npc, give folder rights, and also make these four text docs?

edit: I get the following error, as it refers to this --
"triggerserver( "gui", name, "getMessage" ); "

ERROR: GraalScript: Function triggerserver not found at line 15 in script of -LoginMessage

Any suggestions?

Chompy 02-07-2008 09:45 PM

Quote:

Originally Posted by pokeSMOT (Post 1374021)
For this type of code, do you just create a blank "weapon" npc, give folder rights, and also make these four text docs?

Not a blank weapon npc :P You put in the code in the PHP tags into it. The textfiles is for loading news/text to display

zokemon 02-07-2008 10:17 PM

Quote:

Originally Posted by pokeSMOT (Post 1374021)
For this type of code, do you just create a blank "weapon" npc, give folder rights, and also make these four text docs?

edit: I get the following error, as it refers to this --
"triggerserver( "gui", name, "getMessage" ); "

ERROR: GraalScript: Function triggerserver not found at line 15 in script of -LoginMessage

Any suggestions?

If that is the case, the //#CLIENTSIDE probably was typed wrong or the trigger was called serverside since triggerserver is clientside only.
Was the error in RC?

cbk1994 02-07-2008 11:13 PM

Quote:

Originally Posted by zokemon (Post 1374029)
If that is the case, the //#CLIENTSIDE probably was typed wrong or the trigger was called serverside since triggerserver is clientside only.
Was the error in RC?

Also it should not be checking the functions clientside, right?

Don't those go into F2 upon execution?

pokeSMOT 02-09-2008 12:26 AM

Yes, I still get this error in RC
GraalScript: Function triggerserver not found at line 15 in script of -System/LoginMessage

=-=-=-=-=-=-=-=-=-=
//#CLIENTSIDE
function onCreated()
{
triggerserver( "gui", name, "getMessage" );
}
=-=-=-=-=-=-=-=-=-=

That block of code is still getting an error for some reason :(

cbk1994 02-09-2008 01:08 AM

Quote:

Originally Posted by pokeSMOT (Post 1374221)
Yes, I still get this error in RC
GraalScript: Function triggerserver not found at line 15 in script of -System/LoginMessage

=-=-=-=-=-=-=-=-=-=
//#CLIENTSIDE
function onCreated()
{
triggerserver( "gui", name, "getMessage" );
}
=-=-=-=-=-=-=-=-=-=

That block of code is still getting an error for some reason :(

If you like, if you are on I can come and help you?

Inverness 02-09-2008 02:56 AM

Make sure there is not a space at the end of //#CLIENTSIDE, I believe that can mess it up.


All times are GMT +2. The time now is 04:16 PM.

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