PDA

View Full Version : [LICH-HELP] "checkfried"



100% Wool
02-19-2006, 11:59 AM
- I have the newest version of lich
- I'm using WIZARDFE

Having a problem with the "checkfried" command for Lich
Here's a snippet of my script where it isn't working properly.

----------------------------------
dead1:
pause "3s"
put "loot"
fetchloot
goto "CHECKEXP"

CHECKEXP:
checkfried
if checkfried
goto "GOTOWN"
else
goto "move"
end

------------------------------------

I'm getting no errors from lich itself but what happens is that after I'm fried it still keeps walking around the area instead of going to the "GOTOWN" label

Am I writing the syntax right? Anyone able to help

- Thanks

100% Wool
02-19-2006, 02:06 PM
Nevermind I been told "checkfried" doesn't work for empaths for some reason so I used "checkmind" instead.

Shaelun
02-20-2006, 01:12 PM
I've never been an empath... there seems to be some quirkiness with their experience tag from the game. If I ever figure out why, I'll add a little thingie for them, but yeah -- they never seem to reach the "fully fried" state. If anyone has any ideas, toss 'em out.

Buckwheet
02-20-2006, 01:52 PM
I thought there was another level of XP for them once.

Your mind is totally saturated I thought was the message.

Maybe that was removed?

Shaelun
02-20-2006, 05:09 PM
I think that happens for everyone if you somehow gain experience while already 100% filled. I've never seen it myself, but I've been told about it. Actually that would register as fried to Lich... off-hand I think there are 8 standard "levels" of experience in Wizard. The game tells you that you're fried at 7, and 8 is 100% filled. 9 is what you're talking about I think. "checkfried" checks if you're at 8 or higher, and for some reason, Empaths are never at 8+ from what I can tell.

Jonty
02-20-2006, 08:30 PM
I've never been an empath... there seems to be some quirkiness with their experience tag from the game. If I ever figure out why, I'll add a little thingie for them, but yeah -- they never seem to reach the "fully fried" state. If anyone has any ideas, toss 'em out.

The experience tags seem to be wacky for all of my characters in Wizard(Warrior, Empath, Sorcerer). The meter isn't accurate compared to what you see when you type exp. On some characters it shows less, on others it shows more.

I used this code on two clerics last night:

respond("100% fried = #{checkfried}")
range = 1,2,3,4,5,6,7,8,9
range.each {|num|
respond("#{num.to_s} is #{checkmind(num).to_s}")
}
respond(checkmind.to_s)

Theinformation did not correspond to the experience verb. On a new cleric I created, the script would tell me I was 100% fried, but I wasn't.

Drew2
02-20-2006, 10:29 PM
I use the EXP string thing to check mindstate, because for newer characters the wizard never shows the right thing. For Tayre it's always right, but any young character I make, the wizard shows they're fried way before they actually are. It's stupid.

Jonty
02-21-2006, 02:47 AM
I use the EXP string thing to check mindstate, because for newer characters the wizard never shows the right thing. For Tayre it's always right, but any young character I make, the wizard shows they're fried way before they actually are. It's stupid.

Yeah, I use the string also, ater checking for the the highest experience tag. After I got my healing script to work the way I wanted it to, I decided to try making a hunting script. This is what I use to monitor experience:



def hunt
oneMore = 0
unless checkpcs
if checknpcs("rat") then attLoot end
end
loop {
start_script "walk", ["rat", "script", "rath"]
toggle_unique
unique_waitfor("done")
toggle_unique
attLoot
if checkmind(8)
if oneMore > 0 then break end
fput "ex"
chkFried = waitfor("Your mind ")
if chkFried =~/can't take much more of this!/
oneMore += 1
end
end
}
findPath
end

Shaelun
02-21-2006, 04:46 AM
... yeah... mm... that would be Hellish to compensate for. Didn't realize that was the case. I have to admit, I seriously doubt I'll ever feel like sitting down and figuring out how to fix that...

You're getting pretty damn good with those scripts Jonty :) You may want to shy away from using 'def' to make new commands for a single script. Labels are isolated to the script that uses them, and so are procs. There's also a bunch of technical gibberish and complications with using def (that I won't bore you with). They obviously work though, and if you prefer them, hey -- whatever. Just a suggestion.

Jonty
02-21-2006, 02:32 PM
You're getting pretty damn good with those scripts Jonty :) You may want to shy away from using 'def' to make new commands for a single script. Labels are isolated to the script that uses them, and so are procs. There's also a bunch of technical gibberish and complications with using def (that I won't bore you with). They obviously work though, and if you prefer them, hey -- whatever. Just a suggestion.

Oh. So, what should I use for re-using blocks of code instead of a method/function or proc? I read some of that beginner's guide to ruby in tibits.txt; that's where I got "def" to define methods.

Shaelun
02-21-2006, 03:40 PM
If you don't want to use labels, use procs. This is a def (which you already know, obviously, lol -- just to show you how to turn a def into a proc):


def command(variable1, variable2, etc) # Make the 'command', taking 3 values when called
. (do stuff) # Do the command stuff
end # end the command
command(value1, value2, etc) # Execute the command


This is the same thing, except using a proc instead:

command = proc { |variable1, variable2, etc| # make a proc object that takes 3 arguments
. (do stuff) # stuff that it'll do when called
} # end the proc
command.call value1, value2, etc # Execute the proc, giving it its 3 arguments


Ignore the periods, it's for spacing. It's the same exact thing as 'def', except it's not global (meaning you can't screw up any script except the one using it -- a 'def' can be used by *any* script, not just the one that defines it), and it disappears once the script dies (doesn't hang around eating up system memory the way 'def' does).

Details that you won't find anywhere else (b/c I wrote labels in for Lich, Ruby doesn't actually have them natively): all labels share values for variables. You can jump to any label anywhere in a script, and if a variable existed elsewhere in the script, you can use it without concern from another label. A 'def' method you cannot do that with. A 'proc' object is really quirky about it, but basically you cannot do that with them. Any of the 3 ways will get the job done: in the end, it's hard to argue with what works, ya know :p I suggest sticking to labels mostly because I've taken care of the 'quirky technical stuff' for you. There are times when another way is more convenient though.

Have fun.

Jonty
02-21-2006, 03:49 PM
Ahh okay. I didn't know methods were global. I just noticed ,when I first started scripting with lich, that I couldn't call a poc from within another proc(Now I know why). So, I used methods instead. I think I read somewhere that I can use a proc from within another proc by passing the proc to it.

Shaelun
02-21-2006, 04:10 PM
I know how difficult it can be to track down the cause of odd behavior like that -- programming rocks, but debugging is like banging your head into a wall repeatedly, heh. Anyway, to save you the search for the cause of that...

proc objects include a 'binding' of the environment that they were declared in. Basically you can execute a proc from anywhere at anytime, and while the proc is executing, it's doing so in the same exact environment that you declared it in (so variables that did not exist when you declared the proc do not exist inside the proc, even if you call the proc while those variables really do exist). It's sometimes really, really handy (even if a variable no longer exists outside a proc, inside the proc, it still exists). Pretty much the proc executes exactly where you declared it, no matter where you call it from. So if you declare proc1, then afterward declare proc2, you can call proc1 from within proc2 (because it already existed), but you cannot call proc2 from within proc1 (because it did not exist when you created proc1).

That's the kind of `quirky technical gibberish' I'm talking about when I say I suggest just using labels, lol. Anyway, that's why you probably had trouble.

VotedAfkScrippr
02-27-2006, 03:07 PM
Hey there, just wanted to say that i use lich, its a very nice program, and its built with a really strong engine.

Is there someone who can please help me with some questions about it?

i'm confused on which commands to use for a situation like this:
If i'm using two wizard scripts on lich simutaneously, is there a command that one script could 'put' or call, in order to hault or kill the other script?

also, can i do this using a wizard script? if you put ;kill theotherscript ..this just gets a bad command call from gemstone. it doesn't kill the other script, neither does trying to echo ;kill theotherscript. any help here please?

one more: can i flip flop lich code and wizard code into one script? If not, does that mean i have to completely convert a wizard script, into lich code manually?

..something else to add, maybe if ran a wizard script, and a lich script, could i allow the lich script to kill the wizard script?

Thanks for any help anyone can give me, i tried lich and i'll never use anything else!

Shaelun
02-27-2006, 09:13 PM
I'm glad you're liking it. You may want to read some of the miscellaneous stuff in the text files that come with the prog, it would probably help you understand how Lich works (which makes it easier to use). Trying to send things to the game the way you'd normally use "put .newscript" in an SF script isn't gonna do it (unless you tell Lich to run it as a Wizard/SF script, then it'll start the script like SF would). Up until v3.18 or v3.19, the command reference document was a hideous mass of badly-spaced text. It's a sorta-kinda nice XML document now that you can look at in a web browser. Have a peek, that'll answer your questions I'm sure.

This is buried pretty deep in the docs, so I'll repeat it since you'd probably never find it, heh... Yeah, you can sorta-kinda blend Wizard & Lich scripts... not very effectively though. In any Wizard script, if you run it with Lich, this syntax:

#stupid example.cmd
if_1 goto %1
echo Whatever, it's a Wizard script, you get the idea...
LICH {
(the stuff inside here is basically a Lich script inside the Wizard/SF script, but you *cannot use labels* if you do it this way)
} LICH
echo Back to Wizard junk

Wizard and SF scripts default to fully-restricted (no file access, no advanced internet stuff, no poking around the local computer, blah-blah-blah) -- there's no way to change that (security is good). So don't expect a Wizard script to be able to go order you a pizza from a website or something. Infact it can't do much except use Lich's commands and variables, but use it if you find it handy.

Yeah, Lich uses Ruby's interpreting engine, and it's a really nice and powerful scripting language. That's why Ruby tutorials online apply to Lich too -- I built on to the Ruby interpreter in order to support convenient MUD-based stuff, but it's still Ruby parsing the script files and compiling the symbol tables and stack-scope and... that, sickeningly complicated sort of gibberish that I can't program myself yet, lol. Anyway, enjoy :)

VotedAfkScrippr
02-28-2006, 04:04 AM
Again, thanks for all the help. good advice.