PDA

View Full Version : mod tool: mass change tag values


Trucidation
06-09-2010, 09:18 AM
Yo, here's a useless utility only modders will find useful. Probably. Maybe. I can't think of a nice name so I'll just call it the mass value conversion tool. It's too ugly for a nice name anyway.

What
Editing SW3CW data can be painful, especially if you're trying to apply a global change to many items as once. Example, \Data\Game\Carcasses.xml contains the definitions of the 500+ ship-type items in the game. What happens if you want to double the hp of all those items? Increase all ships' base speed? Edit them manually by hand, one by one? Ha.

With this tool you can simply supply the name of the tag which has the value you want to modify, and then what operation you want to perform on it -- double the value? cut it by half? add 20? whatever, any simple valid mathematical operation is supported.

Why
You can't simply do a search-replace in a text editor; the items have different values. Of course, search-replace is fine if you want to change only specific values. But this script is useful if you want to apply a global change to all tagged values -- like for example to reduce the price of all items by 25%.

How
I used PHP. Sorry, this means you'll need a webserver running locally (or you can just install it somewhere which already has a webserver). Just install XAMPP (http://www.apachefriends.org/en/xampp.html), it's free and easy to use. If you can port this script into a standalone exe or something which doesn't require any other installed tool, be my guest. I only wrote this thing, feel free to take it apart as you like.

-
Install guide:
1. If you don't already have a webserver which can run PHP scripts installed on your PC, click here to download XAMPP (http://www.apachefriends.org/en/xampp.html). Install it. It's quite painless, I assure you.
2. If you used the default everything, your webserver should be pointing to C:\xampp\htdocs. Open that folder in Windows Explorer.
3. In that folder, create a new folder for this script. Give it whatever name you want. (I named my folder jview because I am a lazy and uncreative bastard.)
4. Download the attachment in this post and extract the contents into that folder. There's 3 files in it. You only need 2 -- index.php is merely an unsubtle reminder if you don't point your browser at the correct file.

How to use:
This tool consists of two PHP scripts: jreplace.php contains the parameters and jfolder.php is the interface. You need to edit jreplace.php -- and instructions on how to do this are written in jfolder.php.

Open a browser and go to http://localhost/<the folder name you gave this script>/jfolder.php. Explicit instructions are in there. I'd post them here but people tend to yell "wall of text!", "TL;DR!", "no u!" so just read them there. You can always post here anyway or send me mail.

-

StarShatter
06-10-2010, 08:16 AM
This is pretty exciting, however I've come into some troubles.
I grabbed the Lite version, assuming it would be enough for my simple needs.
Installed it all "C:\Program Files (x86)\XAMPP\xampplite\htdocs\jview"

Entering "http://localhost/jview/jfolder.php" and longer directory names into the address bar.

I've clicked random things and tried stuff, but no avail. So I'm just reading it through notepad, but I can't execute the php.

Should I try the normal version?

You have a background in networking? That would be pretty cool.

Edit: Just editing this so I don't clog up your topic, I'll try it later or tomorrow, really tired ATM, 2 hours of sleep and a long day are not a good combination. Couple weeks off coming up, will be awesome! I'd lend a hand but I don't know much about networking and the associated programing.

Trucidation
06-10-2010, 08:44 AM
D'oh, I forgot XAMPP comes in a lite version, I've never bothered with it. Sorry, if it's not too much trouble, try the regular version of XAMPP - it should be pretty much install-and-go as well. Which random things did you click, you mean on the default localhost/xampp page?

If it works, pointing your browser to localhost/jview/jfolder.php should run the jfolder.php script - you'll see my instructions and a list of files in the folder (click a file to process it). If it doesn't work, i think your browser just shows a blank page or tries to save the file or something.

Well I'm really just a database guy, all this html and php stuff is self-taught so pardon the messy code.