PDA

View Full Version : Some questions



Neco
12-20-2009, 09:16 PM
Well it looks neat, I haven't tried it yet..

Is there a lot of activity? I saw in another thread someones opinions that a lot of scripters had left... left to where? A better utility, or just bored / move on?

I'm not too keen on the Ruby part, but I know enough Python to get by (was building a 1 player Text RPG ala MUD style before I learned of the nightmare called package distribution).. Is it easy to pick up Ruby coming from Python ?

Also.. I've seen at least one note insofar as "this only works with the Wizard, not Stormfront" (healme.lic?) so are there issues with StormFront, or just a functionality difference between the two that was the problem?

Stormfront is my main GUI now, and I really warmed up to it after the expanded scripting abilities it gave over the Wizard. But in developing my skinning script for SF, I still became frustrated at the lack of flexibility I had in solving certain problems..

But I'd really like to have a go and rewriting the script for something like Lich (or is there something better out there now?) if possible, and then maybe expand it to some of my other personal scripts, to make a script-suite based on some common global variables, etc.

Looking at the screenshots, it looks like lich exposes the GSL to you? I've done a bit of light reading, but haven't really seen anything on the intricacies of how it interfaces with the server, and what kind of data it provides / exposes to the user..

Hypothetical..

Would I be able to match a specific text string, and then isolate and pick out a single word from that string, without knowing it beforehand? Either to use as an on-the-fly variable declaration, or to help facilitate in rapidly building a database of variables?

Would I be able to count the number of times a word might appear across several new lines of text, or within a single line? i.e could I count the number of dead critters in the room based on how many times it matches "appears dead" (or whatever the common string is)

Also.. one thing that bothers me, is SF has a tendancy to fail at error correction in scripts.. i.e something happens to falsely set off a trigger, or otherwise interrupt the scripts normal operation (some action, or some kind of scroll of new text, or an error message providing a false match).. Can this be checked for/avoided ?

I'm guessing most of this can be handled one way or another within Ruby, but I guess what I'm asking is, would Lich be able to handle whatever way I chose to interpret it..

But what I'm really interested in knowing is.. is it possible to keep a script running in real-time (or multiple scripts?) Say for instance, a super-script that does actions based on keyword inputs, or a variable being changed to indicate a different "mode" of operation, etc.. (I could see something like this as useful for switching between blessed/e-bladed/normal arrows when I am hunting, etc)


Sorry for all the questions.. I have lots of ideas for scripts and stuff.. Just to be clear, I'm not in the business of automation though, so much as player-assistance. I like to script mundane repetitive stuff, as well as other stuff like maybe looking up information on something, etc.. So I won't be building any uber robot hunting scripts for anyone...I just like to tinker around and then release something to the public if it can help them (like my current skinning script, which I'd love to improve with auto-learning and better case detection routines)

Calbren
12-20-2009, 09:25 PM
I had this nice long reply ready but I'm going to save you some time by saying:

"If you can dream it Lich can do it."

Drew
12-20-2009, 10:04 PM
Yes.

Tillmen
12-20-2009, 10:07 PM
Well it looks neat, I haven't tried it yet..

Is there a lot of activity? I saw in another thread someones opinions that a lot of scripters had left... left to where? A better utility, or just bored / move on?

Noldo and Azanoth, who contributed quite a few scripts, quit Gemstone. If there's a better utility, I don't know what it is.


I'm not too keen on the Ruby part, but I know enough Python to get by (was building a 1 player Text RPG ala MUD style before I learned of the nightmare called package distribution).. Is it easy to pick up Ruby coming from Python ?

I'm not sure how Ruby compares to Python, since I haven't used Python. Ruby seems pretty easy in general to switch to though. It lets you use brackets or begin/end blocks, && or AND, || or OR, etc. However hard it is to switch, Ruby usually becomes the favorite language once learned.


Also.. I've seen at least one note insofar as "this only works with the Wizard, not Stormfront" (healme.lic?) so are there issues with StormFront, or just a functionality difference between the two that was the problem?

That applies to Shaelun's version of Lich (3.57 and earlier). In my version, you get the XML stream whether you're on Stormfront or the Wizard, which takes care of most of the Wizard only/Stormfront only scripts. Scripts that create Stormfront windows should be the only ones that don't work in the Wizard.


Looking at the screenshots, it looks like lich exposes the GSL to you? I've done a bit of light reading, but haven't really seen anything on the intricacies of how it interfaces with the server, and what kind of data it provides / exposes to the user..

Lich will give your script access to the XML stream, or the stream with the XML stripped out. It also gives you access to a whole lot of infomation about your character and the game that it tracks.


Would I be able to match a specific text string, and then isolate and pick out a single word from that string, without knowing it beforehand? Either to use as an on-the-fly variable declaration, or to help facilitate in rapidly building a database of variables?

Yes. That might looks something like:
critter, weapon = matchfindword("? swings a ? at you!")
or

while line = get
if line =~ /(.*) swings a .* at you!
critter_noun = $1.split.last
elsif line =~ /(.*) gestures at you!/
critter_noun =~ $1.split.last
end
end


Would I be able to count the number of times a word might appear across several new lines of text, or within a single line? i.e could I count the number of dead critters in the room based on how many times it matches "appears dead" (or whatever the common string is)

Yes, but you should probably use the GameObj class for that.

num_dead = GameObj.npcs.find_all { |npc| npc.status == 'dead' }.length

GameObj stays up to date without looking at the room.


Also.. one thing that bothers me, is SF has a tendancy to fail at error correction in scripts.. i.e something happens to falsely set off a trigger, or otherwise interrupt the scripts normal operation (some action, or some kind of scroll of new text, or an error message providing a false match).. Can this be checked for/avoided ?

Yes. The most common way for Lich scripts to send a command to game is fput. For example

fput "stand"

Will check the next game line, and retry the command if it's something like "You may only have # typahead lines.", "You are still stunned", "Wait # seconds...", etc.

But this only checks the next game line. A more sure-fire way is dothis or dothistimeout

dothistimeout "stand", 5, /^You stand/

This will keep checking lines until it gets a line that makes it think it should retry the command, or it finds a line starting with "You stand", or five seconds pass without it recognizing a line.

Of course, this example is a little silly, because you can just do:

fput 'stand' until standing?


I'm guessing most of this can be handled one way or another within Ruby, but I guess what I'm asking is, would Lich be able to handle whatever way I chose to interpret it..

Yes. This is not the sort of Gemstone scripting you're used to. Most of what Lich does is not actually built into Lich. The chat client is just another script. There's a script that looks up things on krakiipedia.org and formats the results for you, making the links clickable in Stormfront so it starts up the script again and looks up that link. Your scripts can create windows, either in Stormfront or real windows.


But what I'm really interested in knowing is.. is it possible to keep a script running in real-time (or multiple scripts?) Say for instance, a super-script that does actions based on keyword inputs, or a variable being changed to indicate a different "mode" of operation, etc.. (I could see something like this as useful for switching between blessed/e-bladed/normal arrows when I am hunting, etc)

The number of scripts you can have running is only limited by your hardware, and is probably up in the thousands, though I've never tested the limit.

Neco
12-21-2009, 09:55 AM
Scrapped this reply because I found your Lich project site (I had previously only been to the old one)

Seems like a lot more documentation is available there to answer most of my questions. :)