Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-25-2007, 02:48 AM
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
Login Message

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!
Attached Thumbnails
Click image for larger version

Name:	graal_1195951532.png
Views:	816
Size:	73.1 KB
ID:	43371  
__________________
Reply With Quote
  #2  
Old 11-26-2007, 04:42 AM
foxboi foxboi is offline
zzzzz
foxboi's Avatar
Join Date: Aug 2005
Posts: 101
foxboi is on a distinguished road
how is this GUI activated?
Reply With Quote
  #3  
Old 11-26-2007, 05:18 AM
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
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.
__________________
Reply With Quote
  #4  
Old 11-26-2007, 02:51 PM
foxboi foxboi is offline
zzzzz
foxboi's Avatar
Join Date: Aug 2005
Posts: 101
foxboi is on a distinguished road
It would be awesome if you could post a onKeyPressed or onPlayerChat function for it.
Reply With Quote
  #5  
Old 11-26-2007, 03:30 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by foxboi View Post
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.
Reply With Quote
  #6  
Old 11-27-2007, 12:14 AM
foxboi foxboi is offline
zzzzz
foxboi's Avatar
Join Date: Aug 2005
Posts: 101
foxboi is on a distinguished road
Ah.kk
Reply With Quote
  #7  
Old 11-29-2007, 01:56 AM
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
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!
__________________

Last edited by cbk1994; 11-29-2007 at 01:56 AM.. Reason: missed a tag :(
Reply With Quote
  #8  
Old 12-15-2007, 07:29 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
its till not working for me
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #9  
Old 02-07-2008, 09:42 PM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
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?

Last edited by pokeSMOT; 02-07-2008 at 09:54 PM..
Reply With Quote
  #10  
Old 02-07-2008, 09:45 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by pokeSMOT View Post
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
__________________
Reply With Quote
  #11  
Old 02-07-2008, 10:17 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by pokeSMOT View Post
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?
__________________
Do it with a DON!
Reply With Quote
  #12  
Old 02-07-2008, 11:13 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
Quote:
Originally Posted by zokemon View Post
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?
__________________
Reply With Quote
  #13  
Old 02-09-2008, 12:26 AM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
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
Reply With Quote
  #14  
Old 02-09-2008, 01:08 AM
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
Quote:
Originally Posted by pokeSMOT View Post
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?
__________________
Reply With Quote
  #15  
Old 02-09-2008, 02:56 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Make sure there is not a space at the end of //#CLIENTSIDE, I believe that can mess it up.
__________________
Reply With Quote
  #16  
Old 02-09-2008, 05:35 AM
pokeSMOT pokeSMOT is offline
Registered User
Join Date: Jun 2006
Posts: 35
pokeSMOT is on a distinguished road
Quote:
Originally Posted by cbkbud View Post
If you like, if you are on I can come and help you?
Please do ^_^ I appreciate it so much
Reply With Quote
  #17  
Old 05-11-2010, 10:03 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
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?
Reply With Quote
  #18  
Old 07-04-2010, 04:06 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 DeCeaseD View Post
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?
Yes please.
__________________
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
  #19  
Old 07-04-2010, 04:08 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
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
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #20  
Old 07-04-2010, 05:08 AM
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
You might need to add 'allowedtags' in each of the GuiMLTextCtrl's with the list of allowed tags.
__________________
Reply With Quote
  #21  
Old 08-10-2010, 10:36 AM
TheRuckus TheRuckus is offline
Registered User
TheRuckus's Avatar
Join Date: Jan 2010
Posts: 147
TheRuckus can only hope to improve
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?
Reply With Quote
  #22  
Old 08-10-2010, 11:56 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by TheRuckus View Post
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.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #23  
Old 08-10-2010, 02:16 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Fulg0reSama View Post
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #24  
Old 08-10-2010, 02:22 PM
TheRuckus TheRuckus is offline
Registered User
TheRuckus's Avatar
Join Date: Jan 2010
Posts: 147
TheRuckus can only hope to improve
//#CLIENTSIDE
function onCreated()
{
triggerserver("gui",name,"getMessage");
}
function onActionClientSide( cmd, n, h, s, i )
{


Now its working.
Reply With Quote
  #25  
Old 08-10-2010, 02:25 PM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
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");
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #26  
Old 08-10-2010, 02:25 PM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
damn ruckus ur fast O_o
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #27  
Old 08-11-2010, 02:36 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by TheRuckus View Post
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.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #28  
Old 08-11-2010, 02:38 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by PowerProNL View Post
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
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 04:09 PM.


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