Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-16-2009, 12:18 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Some people (Ziro?) are going to tell you otherwise, but there's no reason to use an "arc" file. You might as well just use a text (.txt) file. Basically, what you're talking about is called a "MUDlib". I'd link you to a Wikipedia article, but I can't on these forums, so just go Google it.

Basically, it's a way to store unique items that can have custom properties. For example, you could easily create a sword with a custom name or stats.

They're traditionally used for RPG servers, but can also be used for other types.

You're going to want to do stuff like:
PHP Code:
temp.vars.loadVars("items/cb/cbk1994/item_1241242452345.txt");
// then you can access stuff like
echo(vars.item_name); 
also look into the functions loadVars and saveVars.

To save you'd do something like

PHP Code:
temp.item = new TStaticVar();
item.item_name "Super Sword";
item.item_weight 1.4;
item.item_power 50;
item.item_class "warrior";

item.saveVars("items/cb/cbk1994/item_random_id_here.txt"); 
You can open the file with File Browser (in RC) to see how it's formatted. Remember that to access files via script, you need to give the NPC-server folder rights, account "(npcserver)" and rights like "rw items/*/*/*".

There are tons of different ways to do it, and everyone likes to do it a different way. You might also want to look into SQLite for item storage.
__________________
Reply With Quote
 


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 01:09 PM.


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