Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Finding information from text document (https://forums.graalonline.com/forums/showthread.php?t=134256457)

sssssssssss 10-14-2009 12:56 AM

Finding information from text document
 
Two questions slightly related:

1. Is there a way to search a text document uploaded in a file to see if it contains information. Like if i want to search the .txt document for guilds to see if an account is in it, and if so, remove it or confirm its there, and if not, add it in?

2. Is there a way to pull specific information from a website into a gui. Forums is one thing I would like to do, but also just pulling a <div class> or something of that sort from a website, and putting the value into the gui.

Switch 10-14-2009 04:27 AM

loadlines(str) savelines(str, int)
Where str is the file and int is 0 (overwrite) or 1 (append).
They load as an array.
For your guild example:
PHP Code:

function onActionServerside() {
  
temp.guild.loadlines("levels/guilds/guildSexy_Time.txt");
  for (
i=0i<temp.guild.size(); i++) {
    if (
player.account in temp.guild[i].tokenize(":")[0]) {
      
player.chat "I'm in the guild dur.";
      return;
    }
  }
  
temp.guild.add(player.account":" @player.nick);
  
temp.guild.savelines("levels/guilds/guildSexy_Time.txt"0);
  
player.chat "I'm now in (Sexy Time) as " @player.nick".";
}
//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat == "guild me baby") {
    
triggerserver("gui"this.namenull);
  }


There's also loadstring(str) savestring(str, int) loadvars(str) savevars(str) with the same parameters for the load and save, except ...sting is for a string and ...vars is for variables, so you need to make whatever var you work with a TStaticVar.
http://graal.net/index.php/Creation/...adstring.28.29


All times are GMT +2. The time now is 04:55 PM.

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