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:	710
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
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 10:57 AM.


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