Mac Users Identify Yourselves!


log in or register to remove this ad

RyanL said:
Cocoa really is quite a nice programming environment. Just for the heck of it, I downloaded an xml doc containing all the 3.5 spells. Within a few hours I had built a simple "Spell Searcher" based on NSXMLParser that can search on any available data element (Name, Level, School, etc.). I then fired up Xcode and Interface Builder and, in a matter of a few more hours, threw together a rough GUI for it.

This is more a testament to the quality of the tools and the NextStep/Cocoa API than to the quality my programming ability, methinks.

-Ryan

Bring it on!

And no, there shouldn't be any legal issues. Looks like that spell list is based on the OGL, so you're good to go.

I, for one, would love to see this.
 

I have to say man you beat me to the punch. Could you post the source code as well? I would be interested in seeing how you did things. I'm currently working on a monsters version. Strangely, I never thought to use XML, I was trying to parse the .rtf files put out by wizard. Doh! :confused:
 

PugioilAudacio said:
I have to say man you beat me to the punch. Could you post the source code as well? I would be interested in seeing how you did things. I'm currently working on a monsters version. Strangely, I never thought to use XML, I was trying to parse the .rtf files put out by wizard. Doh! :confused:

I'm just glad someone else did the work of converting the rtf to xml. A monsters version, as well as a magic items version, would be awesome.

-Ryan
 



I have an XML based spell reference utility that's been available as a limited beta to users of CrystalBall for a couple of weeks now. If you are interested, it's at my iDisk downloads page . It is available for OS X, Pre-OS X (probably OS 8 and up), and Win32. It hasn't been extensively tested on windows, but should be functional. Note that the data folder should be in the same directory as the program itself, and the data sets need to be somewhere in the data folder. I have posted both compressed (sitx) and uncompressed versions of each of the three program flavors, as well as individual data files and a .sitx version of the data folder.

The reference currently searches the SRD data for 3.0, 3.5 and Modern, and will eventually support other areas of SRD like monsters, skills, feats, etc.

It's a bit rough still, but the user can select which of the data sets to search, as well as selecting which of the data fields (or all) to search, as well as case sensitive or insensitive searching. It is free as is, but will probably be released as shareware when I round out the feature set and expand the data set as well.

Registered users of Crystalball will automatically have access to the full version of the reference when it becomes available.

Give it a try, let me know what you think.

Thanks

Raging Epistaxis
 

Well, I'm pretty new to Cocoa (finally read the NSXMLParser documentation today) so I'm probably missing something but...

1. In your parser: DidStartElement: etc. You assign "currentSpell" to a new NSMutableDictionary each time, but you don't release the previous instance of "currentSpell". As I said, I'm probably missing something, but I was wondering why you didn't do this? (I don't think it's autoreleased).

2. In the parser: foundCharacters function you set currentSpell to the string sent in the function. From reading the documentation it appears that you actually need to append the string rather than replace it, as NSXMLParser doesn't always return the entire text contents with one call. How did you get around this?


Thanks,
Pugio
 
Last edited:

PugioilAudacio said:
Well, I'm pretty new to Cocoa (finally read the NSXMLParser documentation today) so I'm probably missing something but...

1. In your parser: DidStartElement: etc. You assign "currentSpell" to a new NSMutableDictionary each time, but you don't release the previous instance of "currentSpell". As I said, I'm probably missing something, but I was wondering why you didn't do this? (I don't think it's autoreleased).

2. In the parser: foundCharacters function you set currentSpell to the string sent in the function. From reading the documentation it appears that you actually need to append the string rather than replace it, as NSXMLParser doesn't always return the entire text contents with one call. How did you get around this?


Thanks,
Pugio

1) As long as you didn't explicitly create the object using alloc/init and you didn't explicitly retain it, you can assume it's been autoreleased. Since we used the convenience method "dictionaryWithCapacity:" rather than alloc/init, it's already been autoreleased.

That being said, I'm not entirely happy with this implementation. It assumes that the objects will persist beyond the current method scope, which is probably bad mojo. But, it was fast to implement.

2) Looks like you found a bug. :)

Edit: Pugio, why don't you drop me an email. r(underscore)lock(at)cox(dot)net

-Ryan
 
Last edited:


Remove ads

Top