PDA

View Full Version : pause help



gs_zen
11-08-2009, 02:27 PM
New to lich, so excuse my ignorance.

I was playing around with some of the posted scripts here, and it seems that everytime there's a "pause", the script ends with an exception.

For example:

def start_hunt
while ((checkmana != maxmana) || (checkfried))
pause 5
end
path_from_rest
hunt_loop
end

gives me the following error:

--- Exception: wrong number of arguments (1 for 0)
testscr2:3:in `start_hunt'
--- Lich: testscr2 has exited.

Is it that I'm just looking at scripts that are too old, so maybe the pause command has been updated/antiquated?

Thanks!
- zen

Alorn15
11-08-2009, 03:14 PM
It sounds more like your version of Lich is antiquated? Pause works for me.

As a quick fix, you might try replacing pause with sleep.

Tillmen
11-08-2009, 04:28 PM
I'm away from my computer and can't test anything, but I have two guesses. First, if the problem is with pause, pause must have been redefined. Look for "def pause" in any script that you've run. The script doesn't have to still be running to redefine pause for other scripts.

The second guess is that the problem is not with pause, but how the start_hunt function is called. If there's anything after start_hunt, like
start_hunt(blah)
or
start_hunt blah
That would give you a similar error.

Deathravin
11-08-2009, 05:08 PM
def start_hunt()
pause("5s") while ((checkmana != maxmana) || checkfried)
path_from_rest
hunt_loop
end

just how I do the pauses... dunno if it's right or not.

gs_zen
11-08-2009, 08:49 PM
I tried this suggestion:
pause("5s") while ((checkmana != maxmana) || checkfried)

Got the same result, only a different line number (due to the different line pause was on).

I'm sure it's the pause command, cause it was somewhere else in the script, and I removed it, and got a bit further in the script.

I'll try the sleep (instead of pause) command tonight.

As for other scripts. Maybe. I just installed lich last night, from the lichproject.com website (easy install). I did add psinet (I was already familiar with psinet, particularly atlas - so I wanted that as an option until I feel comfortable with lich. Maybe that has something to do with it? The install seemed to go really smoothly. I'm also running Windows 7 (just throwing up everything I can think of).

I have no other scripts running that I know of, at least no other scripts that I've edited, altered myself.

Here's the full script. I copied this from a post in the hunting 11-20 forum. The only thing I did to it, was to remove the pause during the casting, and removed the CoL signs (my wizard isn't in CoL).

You folks are quick to respond with help. Thanks!

- Zen

Deathravin
11-08-2009, 08:52 PM
OH... I remember, wasn't there an issue with pause... what the heck was that... Tillmen helped me out with it... was a long time ago.

I think it was when I tried to use Lich on Windows 7 and had it installed to Program Files instead of somewhere with uninterrupted write access.

Reinstall it to like MyDocuments or something and it might work.

gs_zen
11-08-2009, 09:06 PM
You know, I have no idea where lich installed to. I don't see anything regarding it in my program files. I do have SGE and PsiNet in PF. The lich.rb file is in a directory off my desktop (the folder where I downloaded the file to, and ran the install from).

Sleep did work btw.

I'll dig around to figure out where it installed to, and reinstall if that's the case.

Thanks!

- Zen

Tillmen
11-08-2009, 09:50 PM
When you tell Lich to install, it only changes some registry keys so that Lich is started by SGE and website login. It doesn't actually install any Lich files anywhere. So, Lich is "installed" to that folder off of your desktop. It should have write permission there, so that shouldn't be any problem. Looking at the script gives me an another idea of what the problem is. It involves the workaround to implement goto labels, which got harder in Ruby 1.9. When goto is called, it actually causes a named error on purpose. Then in the error handling, it finds the label you want and starts the script there. With Ruby 1.9, this causes you to lose all your variables, so I tied the variables to the script. I believe pause is now calling script.pause for you. This will need a small update to Lich to fix, which I should be able to do a little later tonight.

Tillmen
11-08-2009, 10:34 PM
Lich 4.0.8 is up for automatic updating, and fixes this problem.

gs_zen
11-12-2009, 10:09 PM
I reinstalled ruby, got past the dll file, and now I just get a mesage saying downloading and nothing ever happens...

>;sloot
--- Lich: sloot active.
================================================== ==
| Download Started |
================================================== ==
Now downloading: [["SpiffyLib-loot-db.xml"]].
This may take a while depending on the size...


Last night, my go2 was working fine, tonight it won't work outside of town.

--- Lich: go2 active.
[go2: Your map database is outdated, and possibly incompatible with this script.]
[go2: Map.dijkstra: error: coerce must return [x, y]]
C:/Users/user/Desktop/new desk/gs4/Scripts/lich.rbw:3342:in `+'
C:/Users/user/Desktop/new desk/gs4/Scripts/lich.rbw:3342:in `block in dijkstra'
C:/Users/user/Desktop/new desk/gs4/Scripts/lich.rbw:3340:in `each'
C:/Users/user/Desktop/new desk/gs4/Scripts/lich.rbw:3340:in `dijkstra'
go2:733:in `block in start_script'
C:/Users/user/Desktop/new desk/gs4/Scripts/lich.rbw:3601:in `eval'
C:/Users/user/Desktop/new desk/gs4/Scripts/lich.rbw:3601:in `block in start_script'
[go2: error: failed to find a path between your current room (281) and destination room (11)]
--- Lich: go2 has exited.
>

This came up because I kept getting an error saying cannot find a path to target, which the same target had worked the day before. so I tried to update the map and go2.

Alorn15
11-12-2009, 11:45 PM
That's... really ugly. Did you try ';updater update forcemap'?

Tillmen
11-12-2009, 11:53 PM
The map.dat in the repository is for Lich 3.57 and earlier. To update your map database, use:

;updater update forcemap

You only need to do this if you want to download the same version of the map database you've already downloaded. Unless you've disabled it, updater will automatically download the map database when there's an update.

The problem probably only came up because go2 failed to move for some reason and thought there was an error in the map database.

As for sloot.. I don't know much about that.

gs_zen
11-13-2009, 11:28 AM
I got the go2 working. It was the map incompatibility. Thx

I may wait on the sloot, or start a different thread about that one. I think the problem is I just don't have that xml file it's refering to.

- Zen

BigWorm
11-13-2009, 11:50 AM
I got the go2 working. It was the map incompatibility. Thx

I may wait on the sloot, or start a different thread about that one. I think the problem is I just don't have that xml file it's refering to.

- Zen

Sounds like a very similar problem to this one (http://forum.gsplayers.com/showthread.php?t=44976).