Bits and ConText

I guess I may as well tell you guys all these questions are because I'm working on SFA and getting stuff done.

Here's another one:

There is no external documentation keeping track of all the used NCBs. There is a notes file on important bits, such as storyline start/end, rank bits, etc, but there's no list telling me what bits are available to use.

I need to figure this out, here's my current idea, but I'm pretty bad with database stuff. Help me if you can please:

Use ConText to export all the missions, outfits, crons (that should cover all the bits)
Make some sort of script that runs through all the NCB fields and pulls out every bxxx/!bxxx, writes the xxx (number) part down somewhere, then removes duplicates and sorts them in ascending numeric order.

I really don't know where to start with this. As far as tools available, I have Excel, FileMaker, MySQL, PostgreSQL, and C++. Where should I start? What should I do?

This post has been edited by LNSU : 07 February 2011 - 10:19 AM

@lnsu, on 07 February 2011 - 10:18 AM, said in Bits and ConText:

I really don't know where to start with this. As far as tools available, I have Excel, FileMaker, MySQL, PostgreSQL, and C++. Where should I start? What should I do?

To be honest, you could probably do this from the Terminal (if you're on a Mac, which I assume you are) - you might be able to run:

sed 's/.*b\((0-9)\+\).*/\1/' file | sort -un

Obviously, replace file with your filename, but what that should do is look for all strings like: 'bnumber', and then will sort the number numerically, though it loses the 'b' on the way through.

Hope this helps.

This post has been edited by Ephialtes : 07 February 2011 - 01:12 PM

@ephialtes, on 07 February 2011 - 01:02 PM, said in Bits and ConText:

To be honest, you could probably do this from the Terminal (if you're on a Mac, which I assume you are) - you might be able to run:

sed 's/.*b\((0-9)\+\).*/\1/' file | sort -un

Obviously, replace file with your filename, but what that should do is look for all strings like: 'bnumber', and then will sort the number numerically, though it loses the 'b' on the way through.

Hope this helps.

That'll do it. Thanks.

@guy, on 07 February 2011 - 02:09 PM, said in Bits and ConText:

NovaTool's Mission BitMap

Doesn't work. It chokes when I feed it the SFA folder, or even one file and select just the missions. It complains that a bit is used more than 299 times, and doesn't finish.

Specifically b9000, which is documented in the notes as:

Quote

b9000 if player has accepted certain types of missions. Used to keep the player from taking on more than one mission at a time, with a few exceptions (miners, etc.) It turns off when the mission is completed, failed or aborted.

Apparently it shows up more than 299 times. Ouch.

This post has been edited by LNSU : 07 February 2011 - 02:48 PM

http://dl.dropbox.co...439/BitList.txt

That's a dump (rather unorganized) of everything from every NCB field in the Crons, Missions, and Outfits of SFA. I used ConText and Excel, then some manual text editing to get that.

Now I just need to pull out the numbers from every bxxx in that file. Ephialtes, I tried your command but it only pulled out some of the bits, not all of them, and a few Gxxx expressions too.

This post has been edited by LNSU : 07 February 2011 - 02:47 PM

I did not know Mission Bitmap has that restriction. Interesting.

What I would do is ConText everything that has NCB strings, open in Excel (making sure to preserve quotes around text on import, etc.), find and replace all “b9000” with a blank string, copy into TextWrangler (find and replace all <tab><return> with <return> until no more remain, if necessary) and save as Western (Mac OS Roman) Classic Mac (CR), ResStore to a plug-in, run Mission Bitmap on that, which should now work if b9000 is the only problem.

That gives you the sorted data for everything except b9000. Then use ConText and whatever find/replace/scripting you need to get just the info on when b9000 is used.

This post has been edited by Qaanol : 07 February 2011 - 09:40 PM

You are absolutely right, I messed something up. I'll try and get the list for you now and will post a working command shortly.

Apologies for that, I didn't account for several variables, namely 1) Multiple bxxx on one line, and 2) That sed will print the line even if it doesn't find anything, without -n supplied.

So I switched to perl, as I'm fed up of trying to remember which bits of the regexp I need to escape when using sed. I've attached what I believe to be the correct list of used bits, and the very very simple script I used to find them (which is really just a single piece of regexp and could most likely be implemented in a sed one-liner).

Run using:

 ./bitextractor.pl BitList.txt | sort -un

Since there's no point reinventing the wheel and implementing sort in the script.

NB: I had to upload bitextractor.pl as bitextractor.txt for board reasons.

Attached File(s)

@qaanol, on 07 February 2011 - 09:39 PM, said in Bits and ConText:

What I would do is ConText everything that has NCB strings, open in Excel (making sure to preserve quotes around text on import, etc.), find and replace all “b9000” with a blank string, copy into TextWrangler (find and replace all <tab><return> with <return> until no more remain, if necessary) and save as Western (Mac OS Roman) Classic Mac (CR), ResStore to a plug-in, run Mission Bitmap on that, which should now work if b9000 is the only problem.

Excel 2011? Previous versions worked perfectly with ConText/ResStore but 2011 seems to refuse to handle MacRoman encoding (hopefully just a bug which can/will be fixed). Here's what I did:

  1. ConText
  2. Open in TextEdit and save as Windows Latin
  3. Open in Excel, do your stuff, save
  4. Open in TextEdit again and save back to MacRoman
  5. ResStore
    The extra tabs/returns or whatever didn't seem to be a problem for ResStore.