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.

pokeSMOT 02-09-2008 05:35 AM

Quote:

Originally Posted by cbkbud (Post 1374228)
If you like, if you are on I can come and help you?

Please do ^_^ I appreciate it so much

DeCeaseD 05-11-2010 10:03 PM

I'm rather curious as to how I would make any text within the text files bold, centered, italicized, etc? I've tried using things like <b></b>, and , but it simply just shows the cased in letters. Anyone mind letting me know? x_x

sssssssssss 07-04-2010 04:06 AM

Quote:

Originally Posted by DeCeaseD (Post 1575446)
I'm rather curious as to how I would make any text within the text files bold, centered, italicized, etc? I've tried using things like <b></b>, and , but it simply just shows the cased in letters. Anyone mind letting me know? x_x

Yes please. :(

Fulg0reSama 07-04-2010 04:08 AM

Usually HTML works

<img src="">
<i></i>
<b></b>
<a href="destinationhere"></a>

all work usually. At least I know a lot of this except the a href in text file login message

cbk1994 07-04-2010 05:08 AM

You might need to add 'allowedtags' in each of the GuiMLTextCtrl's with the list of allowed tags.

TheRuckus 08-10-2010 10:36 AM

I also get this error:
Weapon/GUI-script -System/LoginMessage added/updated by TheRuckus
Script: Function triggerserver not found at line 17 in script of -System/LoginMessage
The line is
triggerserver("gui",name,"getMessage");

How do i fix this?

Fulg0reSama 08-10-2010 11:56 AM

Quote:

Originally Posted by TheRuckus (Post 1592560)
I also get this error:
Weapon/GUI-script -System/LoginMessage added/updated by TheRuckus
Script: Function triggerserver not found at line 17 in script of -System/LoginMessage
The line is
triggerserver("gui",name,"getMessage");

How do i fix this?

I believe the order is wrong, Not a real scripter but if you really wanted to be sure just /scripthelp in rc.

PHP Code:

triggerserver("gui","cost",this.name); 

that's a quick example.

xXziroXx 08-10-2010 02:16 PM

Quote:

Originally Posted by Fulg0reSama (Post 1592564)
I believe the order is wrong, Not a real scripter but if you really wanted to be sure just /scripthelp in rc.

PHP Code:

triggerserver("gui","cost",this.name); 

that's a quick example.

Wrong.

TheRuckus 08-10-2010 02:22 PM

//#CLIENTSIDE
function onCreated()
{
triggerserver("gui",name,"getMessage");
}
function onActionClientSide( cmd, n, h, s, i )
{


Now its working.

PowerProNL 08-10-2010 02:25 PM

re
 
Ruckus you used //#SERVERSIDE in the script that's why the error pops up

use //#CLIENTSIDE cuz everything above is already serversided

and dude fulg0re it's triggerserver("gui",this.name,"whatever");

PowerProNL 08-10-2010 02:25 PM

damn ruckus ur fast O_o

Tigairius 08-11-2010 02:36 AM

Quote:

Originally Posted by TheRuckus (Post 1592560)
I also get this error:
Weapon/GUI-script -System/LoginMessage added/updated by TheRuckus
Script: Function triggerserver not found at line 17 in script of -System/LoginMessage
The line is
triggerserver("gui",name,"getMessage");

How do i fix this?

I know you said you got it working, but this problem is generally caused by a space after //#CLIENTSIDE for future reference.

xXziroXx 08-11-2010 02:38 AM

Quote:

Originally Posted by PowerProNL (Post 1592581)
Ruckus you used //#SERVERSIDE in the script that's why the error pops up

use //#CLIENTSIDE cuz everything above is already serversided

and dude fulg0re it's triggerserver("gui",this.name,"whatever");

Contrary to popular beliefs, adding //#SERVERSIDE does *not* break your script, even though it's ridiculous to do so in the first place.


All times are GMT +2. The time now is 07:49 AM.

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