PDA

View Full Version : Lich checknpcs



Deathravin
05-06-2008, 02:58 PM
Can Lich tell you what NPCs are stunned or prone? (based on look messaging of course, I don't expect it to know that mob A is prone and stunned).

Deathravin
05-07-2008, 04:11 PM
Guess that's a no.

Shaelun
05-10-2008, 08:10 PM
Are you asking if it has a "canned" method of doing that (as in prewritten), or are you asking if it could at all...?

No, it doesn't come with a prewritten way of doing that, and yes, of course you could implement it.

Deathravin
05-13-2008, 01:16 PM
Guess I just don't know how to check the room window. I'd assume it's in the stream, but I'm not familar enough with how to do it.

Basically what I wanted was a warcamp script. It would target things based on name, prone and stunned status. For instance the target order would be:

Pures - unstunned - standing
Semis - unstunned - standing
Squares - unstunned - standing
Pures - unstunned - prone
Semis - unstunned - prone
Pures - stunned - either
Semis - stunned - either
Squares - unstunned - prone
Squares - stunned - either

Any time there was a change in what was in the room, be it because something becomes stunned, something leaves or enteres the room etc, it would retarget based on those critera. What I don't need in a warcamp is more screenscroll so I'd assume it would do via data in the room window.

My problem is I'm a moron. I know how to do some things, but not most. When I see things like the ;maxlock script, I know that's wrong. I can even make it somewhat right with a procedure and an array. But I can't get to the ;maxlock2 level of coding without help.

Shaelun
05-17-2008, 04:03 AM
Just because you haven't learned something yet doesn't mean you're a moron, first of all... second of all, what you're asking may be kind of tricky.

If you're interested enough to put the effort into it that I think you'd need to, you probably want to start with toggle_status. That will make sure your script receives everything, not just what shows up in the story window. From there you can write your own method to track what critters are around and which ones are an immediate threat (i.e. not stunned or whatever), then have another script (or the same script, whatever you like) use that information.

Or if you're really industrious, you could actually extend Lich's basic SF tracking itself. The nuts-and-bolts are written in C, but the relevant stuff is written in Ruby -- you can look at it in the "sfparser.rb" file if you want to (from the source download, not the basic install).

The file is pretty well commented, but it likely won't be obvious how it's working... basically the C code parses the XML that SF receives, and checks for a matching Ruby method in the SFMetadata module. A module is basically a class that you can't create objects of.

Why is that useful? Well you can use modules to extend other classes, or even extend the methods of a single object (but not its entire class). So what I'm saying is that if you add methods to the SFMetadata module, Lich will automatically know how to use them and do whatever you've told it to. That way you could add your code to a script to run at startup, and forever after have your custom tracking and associated methods.


If you don't feel like you have a good grasp of object oriented programming, the latter route would be challenging (but you'd learn a ton in the process). Whichever way you choose, good luck.