Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   MUD assistance (https://forums.graalonline.com/forums/showthread.php?t=84134)

thatdwarf 02-11-2009 03:45 AM

MUD assistance
 
Alright, I have virtually no experiece with "MUD's", or anything relating to the system (that I am aware of)

I wanted to ask if anybody would mind telling me what subjects I should research to get started?

(And if you have links to documentation on those subjects, that would be even better! :D)

Thanks in advance!

Tigairius 02-11-2009 04:09 AM

Go to wikipedia.org and search for "MUD," I'd link it but it discusses some of the games that are MUDs.

That'll show you what MUD is, but a mudlib is the library which contains all of the account information & stuff for the mud.

A mudlib is a library of interpreted code used to create a MUD game.

There are pretty uncommon instances where it's necessary to use a MUDLIB on Graal.

Most people confuse MUDLIB for any form of text file storage.

thatdwarf 02-11-2009 04:17 AM

hmm
I suppose it was a bad idea for me to use the term MUD
I'm refering to the method that certain servers use to create Item Systems, etc

An example

I cant really make heads or tails of what is going on in there, so I was wondering if someone could basically strip it down to the methods used to create something like that

Does that make sense a bit better than my first post?

Tigairius 02-11-2009 04:27 AM

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/'.

WhiteDragon 02-11-2009 05:09 AM

Yeah, the term "MUD" is honestly one of the worst misnomers in scripting here; people keep on using it as a term for a data storage system while it more or less has nothing to do with that.

Note that what was done above by Tigairius is good for something like an item system or anything that needs to be persistent through a restart of the NPC server.

However, if you need something that only needs to be kept in memory, it would be much faster to just store it as flags on an NPC and also help rid yourself of potential I/O problems.

Tigairius 02-11-2009 05:56 AM

Quote:

Originally Posted by WhiteDragon (Post 1465236)
it would be much faster to just store it as flags on an NPC and also help rid yourself of potential I/O problems.

I agree.

thatdwarf 02-12-2009 08:06 PM

Agreed.
I am in the process of constructing an "item" system that will hopefully curtail the use of many different types of these items, not as complex as, say, zodiac, but still pretty hefty in size.

I figured it'd be easier to do the items this way when it came to storing, searching, and updating



By the way, is there any formal name for a text file storage system?

Chompy 02-12-2009 09:12 PM

Quote:

Originally Posted by thatdwarf (Post 1465742)
By the way, is there any formal name for a text file storage system?

Just call it Custom Item System and there you go. :)


All times are GMT +2. The time now is 10:15 AM.

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