PDA

View Full Version : Transferring a SF script to Lich



Wee!
11-05-2015, 03:54 AM
I had 3 scripts built in SF. One for Crafting a perfect hammer-handle, one for a perfect hammer-head, and one to put them together.

So I put all 3 scripts together in one and added a function for it to turn itself off at 50% mind (unless it's at the point of vising the hammer, then it will try to vise the hammer and shut itself off after that).

I'd like to transfer it to Lich. My goal is this; once bigshot enters rest mode it will run useherbs, slootsell, and waggle. Then it can run op (as I've called it).

Hopefully op will turn itself off at 50% and send me back to my favorite resting spot in time for bigshot to start it's hunt.

As of right now the script isn't getting very far in Lich.
It functions perfectly in SF.

I copied and pasted the script into notepad and saved the text file in my lich scripts folder as a .cmd.

The first few lines of the SF script are as follows:

put ;go2 2441
waitforre /A shiny orange curtain covers the north wall, marking the entrance to a locker booth. The hallway branches off here, with more locker booths visible to the southeast and northeast./
put go curtain
wait 1
put open locker
wait 1
put get apron
wait 1
put wear apron
wait 1
put get hammer-handle from cloak
match onhead You remove a
match onhandle Get what?
matchwait

This is what happens when I run it in Lich:

>;op
--- Lich: unknown line: match onhead
--- Lich: unknown line: put;go2 forge
--- Lich: op active.
--- Lich: go2 active.
--- Lich: op has exited.
[go2: ETA: 0:00:03 (16 rooms to move through)]
[go2]>go gate

As you can see. It starts op as a Lich script and executes go2. But it immediately turns itself off after the first few lines and gives a few errors.

Anybody with any experience converting SF scripts to Lich; your help would be greatly appreciated.
If there's a script that already does this. I'd love to know the name :) Also, If there's a way to make bigshot run a SF script after it runs the lich scripts in rest mode; that could also be helpful.

I was going to post the entire script, but it's long and I don't know if anyone would want to comb through the entire thing. So I'll leave you with this little bit of information to see if there's an easy fix. If you need the whole script I'd be happy to post it.

GS4Pirate
11-05-2015, 07:06 AM
is it hanging up on your waits? may be better to try waitfor. Just a shot in the dark without seeing the onhead routine.

If you can't get it to work, you could always keep it running in the background through SF and let Bigshot or one of the other scripts running at the end of your hunt trigger it with a waitfor.

Wee!
11-05-2015, 01:29 PM
I don't know what it's hanging up on. I don't know Ruby, so I can't tell you what's wrong.
I think it has something to do with the fact that I'm using ;go2 commands.

Changing the SF script to waitfor isn't an option, wait and match do two different things.

I did change the:

waitforre /A shiny orange curtain covers the north wall, marking the entrance to a locker booth. The hallway branches off here, with more locker booths visible to the southeast and northeast./

to:

waitfor A shiny orange curtain covers the north wall, marking the entrance to a locker booth. The hallway branches off here, with more locker booths visible to the southeast and northeast.

It didn't need to be a waitforre

Is there a Lich script that will execute a SF script?

I'm going to add directions instead of using the ;go2 commands. We'll see if this fixes it. I wanted to use the ;go2 command because then I could start the script in any room. But it will likely start in the same "resting" room anyway. So changing it to directions aught to be ok.

GS4Pirate
11-05-2015, 02:07 PM
"Is there a Lich script that will execute a SF script?"

I would set up a trigger in your Stormfront script. The last script you have for your end hunt in bigshot, when it finishes, have your script match part of the ending echo. For example I used to use the end of sloot sell to trigger a script that would whisper to another character to start his picking script.

So in Stormfront there is no waitfor? Like:

waitfor Billybob just finished hunting <---- your script would be running constantly waiting for this to echo, then perform the rest of the script when it is detected.

The rest of your script.....

Wee!
11-05-2015, 02:29 PM
That's a good option. I'll give it a try. TY.

GS4Pirate
11-05-2015, 06:12 PM
Happy to help. I would also suggest (not trying to write your stuff) changing your: wait 1's to waitfor's. There are two reasons for this, the most important one being, you will find wait can have hang up issues and can act weird. The second reason for using waitfor, it's much, much faster.

An easy script I use for putting signs up. (this is for wizard FE, not a whole lot different from Stormfront)

put sign of smiting
waitfor you
put sign of defend
waitfor you
put sign of shield
waitfor you

etc....

When I first started writing scripts, I used the wait 1 like you have in your example and it would have occasional hang up issues. When I changed it to waitfor, it has never hung up and it takes a little over a second to put up all my signs.

Just a thought.

P.S. Use the end of your ;go2 echo to trigger your script. That should do it. Make sure you use the room number somehow in the waitfor or your script will be popping off every time you use ;go2

Tillmen
11-14-2015, 04:44 AM
When a Stormfront script uses "put .scriptname", to start another script, the first script exits since Stormfront can only run one script at a time. Lich mimics this when it runs Stormfront scripts so that the scripts don't start doing new and exciting things just because Lich is running it. A Stormfront script running in Lich wasn't always able to start a Lich script; I added that later, and I did it wrong. All I did was add "put ;scriptname" to the same code that was dealing with "put .scriptname". So, your script is exiting because it's starting go2.

I fixed the bug in wiz_to_lich.lic, which is a script that converts Wizard/Stormfront scripts into Lich scripts and saves the result. This is the same conversion that Lich does every time it runs a Stormfront script. I'll fix the bug in Lich eventually.

If you use wiz_to_lich.lic, keep in mind that the result is not what a Lich script should look like. It should create a good starting point for improving the script though.