Thread: MUD assistance
View Single Post
  #4  
Old 02-11-2009, 04:27 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
Sure, let's break it down into simple terms.

Here is a method to create some sort of simple storage system.

First, you need to give yourself and your NPC-Server rights to your item system.

HTML Code:
rw items/*.txt"

Now, let's say your item format is (Let's say the document name is sword.txt, herein is your variables):
HTML Code:
title=Broad Sword
damage=5
strength=3
id=1234
You can read that information by loading your file with Graal's built in parser for text-file strings.

PHP Code:
  temp.variables.loadvars("items/sword.txt");
  echo(
"The sword's name is" SPC temp.variables.title); 
You can also make changes to your loaded variables & save them to the sword file.

PHP Code:
  temp.variables.loadvars("items/sword.txt");
  echo(
"The sword's name is" SPC temp.variables.title);
  
temp.variables.title "Magic Sword";
  echo(
"The sword's new name is" SPC temp.variables.title);
  
temp.variables.savevars("items/sword.txt"0); 
Let's say you want a list of all of your item files for item searching, etc.

PHP Code:
  temp.folder.loadfolder("items/*.txt"0); 
This will return an array of all of the files within 'items/'.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote