Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-21-2011, 01:53 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quick Gui Question

Quick scripting quesiton, How can I load text from a .txt file that is stored on the server and show it in a gui text control?

this is what I have so far;
PHP Code:
      new GuiMLTextCtrl("CMD_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 17;
        
horizsizing "width";
        
width 463;
        
text gettext("Staff_Commands.txt"); //Something like that?
      

Reply With Quote
  #2  
Old 12-21-2011, 01:58 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Alpho View Post
Quick scripting quesiton, How can I load text from a .txt file that is stored on the server and show it in a gui text control?

this is what I have so far;
PHP Code:
      new GuiMLTextCtrl("CMD_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 17;
        
horizsizing "width";
        
width 463;
        
text gettext("Staff_Commands.txt"); //Something like that?
      

GUI Controls are Clientside, if the text file is stored on the server you need to communicate between the client and server in order to retrieve its data.
Reply With Quote
  #3  
Old 12-21-2011, 01:59 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Here's a hint:

1. triggerserver requesting text
2. load text in onActionServerSide using loadstring
3. send text to client using triggerclient
4. set text based on data from onActionClientSide

Please try and search the forums about each topic.

My guide has links to content that will help as well, see my sig for that.
__________________
Quote:
Reply With Quote
  #4  
Old 12-21-2011, 02:00 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
GUI Controls are Clientside, if the text file is stored on the server you need to communicate between the client and server in order to retrieve its data.
Ok, thank you.

As for the function to get the data from the text file, what would that be?
Reply With Quote
  #5  
Old 12-21-2011, 02:01 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quote:
Originally Posted by fowlplay4 View Post
2. load text in onActionServerSide using loadstring
loadstring, thank you for that.
And I will check out your tutorial/guide =]
Reply With Quote
  #6  
Old 12-21-2011, 02:08 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Exclamation

Quote:
Originally Posted by fowlplay4 View Post
My guide has links to content that will help as well, see my sig for that.
I looked for loadstring on your page and It says:
There is no page titled "loadstring".

Where do I upload the txt file to?
Reply With Quote
  #7  
Old 12-21-2011, 02:15 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Alpho View Post
I looked for loadstring on your page and It says:
There is no page titled "loadstring".

Where do I upload the txt file to?
There's some examples under the File I/O section. Search the forums for loadstring as well, you should be able to find plenty of examples that way.
__________________
Quote:
Reply With Quote
  #8  
Old 12-21-2011, 02:19 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Okay I got this:
PHP Code:
echo(loadlines("levels/Staff_Commands.txt")); 
though, it returns 0
Reply With Quote
  #9  
Old 12-21-2011, 02:21 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Alpho View Post
Okay I got this:
PHP Code:
echo(loadlines("levels/Staff_Commands.txt")); 
though, it returns 0
loadlines(); needs to be attached to a variable name:

PHP Code:
temp.l.loadlines("levels/Staff_Commands.txt");
echo(
temp.l); 
Reply With Quote
  #10  
Old 12-21-2011, 02:24 AM
Alpho Alpho is offline
Registered User
Alpho's Avatar
Join Date: Dec 2011
Location: California, USA
Posts: 80
Alpho will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
loadlines(); needs to be attached to a variable name:

PHP Code:
temp.l.loadlines("levels/Staff_Commands.txt");
echo(
temp.l); 
Thank ffcmike! Helped a bunch!
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 05:37 AM.


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