Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-21-2011, 03:54 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Storing with serverr.

I was reading through Fowlplay4's scripting guide and I suddenly decided to make a simple script that stores text on the server, safe from updating a level. I read through the forums and found that the use of serverr to store data was a favored method, so I studied some more on the wiki and decided to go and make a simple GUI interface consisting of a MuliLineTextEditCtrl an a Window. All it does is read from the serverr and displays the text in the multiline. Here is what I have.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
NewsScreen();
  
this.newsteam = {
    
"McChucken""Callimuc"
  
};
  
player.chat "News Updated"//Alerts the player
}

function 
onPlayerChats() {
  if (
player.chat == "!news") {
    
NewsScreen(); //Shows the GUI
  
}
  if (
player.chat.starts("!setnews ")) {
    if (
player.communityname in this.newsteam) { //Protection
      
serverr.news player.chat.substring(9); //Everything after !setnews
    
}
  }
}

function 
NewsScreen() {
  new 
GuiWindowCtrl("News_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "320,240";
    
isexternal true;
    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canresize false;
    
closequery false;
    
destroyonhide true;
    
text "Server News";
    
405;
    
218;
    new 
GuiScrollCtrl("News_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 228;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 308;
      
6;
      
7;
      new 
GuiMLTextCtrl("News_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
htmlcompatibility true;
        
htmllinks true;
        
text serverr.news;
        
width 283;
      }
    }
  }

The only issue I am having is that when I log out and in again to the server, the text in the multiline is 0 (NULL). What am I missing here. The script has no purpose at all other than helping me learn.

Does the serverr have to be on the serverside to store the data?
__________________
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:28 PM.


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