PDA

View Full Version : Aid with matching numbers with text



Morrff
12-13-2009, 06:28 PM
What I'm attempting to do is catch the wealth verb to how many coins I have and I was just playing around with it like this a bit.

;e echo fput "weal"; waitfor "You have"; if line =~ /You have.+ \(\-([0-9]+)\)\./ then fput "true" end
exec1: warning: parenthesize argument(s) for future version
--- Lich: exec1 active.
[exec1]>weal
You have 9443 coins with you.

[exec1: You have 9443 coins with you.]
--- Exception: undefined local variable or method `line' for main:Object
--- Lich: exec1 has exited.
;e echo fput "weal"; waitfor "You have"; if line =~ /You have.+ \(\-([0-9]+)\)\./ then fput "true" end; else fput "false" end
exec1: warning: parenthesize argument(s) for future version
--- Lich SyntaxError: compile error
exec1: syntax error, unexpected kELSE, expecting $end
echo fput "weal"; waitfor "You have"; if line =~ /You have.+ \(\-([0-9]+)\)\./ then fput "true" end; else fput "false" end
^
--- Lich: exec1 has exited.

Ultimate goal is to use this in a looting script for boxes and either depositing coins at the local bank or handing them off to someone where I'm picking. Thanks for any help in advance.

ALSO can someone paste me the new server location I need to edit into my Lichnet2.lic file so I can ask over Lnet these simple questions? Thanks

Cylas

Morrff
12-13-2009, 06:49 PM
I'll also be attempting to figure this out. I want to use this same sort of method or something similar for matching someone in the room where I am and giving them the coins

boxlist = checkloot.find_all { |thing| thing =~ /strongbox|coffer|chest|box|trunk/ }
if boxlist.empty?
exit
else
$snp_Box_Type = boxlist.shift

Was thinking something like this

personlist = checkpc.find_all { |person| person =~ /Bob|Jeff|Joseph|Alorn15|Steve/ }
if personlist.empty? then start_script "bankdeposit"
exit
else
$snp_Person_Here = personlist.shift
fput "Give ### silver to #{$snp_Person_Here}"
waitrt?
end


Thanks for any help in advance I'll be tinkering for a bit until I get discouraged most likely.

Tordane
12-13-2009, 07:30 PM
ALSO can someone paste me the new server location I need to edit into my Lichnet2.lic file so I can ask over Lnet these simple questions? Thanks


lichproject.com

Tillmen
12-13-2009, 07:31 PM
The new server is lichproject.com



;e fput 'wealth'; silver = matchfind("You have ?"); echo silver
;e fput 'info'; silver = matchfind("Silver: ?"); echo silver


The wealth command is visible to other players, and is probably an annoying thing for a script to do all the time. The info command isn't visible to other players, but scrolls your screen. If you were using my version of Lich, you could do this without scrolling your screen or letting other players see that you're checking your pockets.

I'm not sure what to make of the second post.. It looks like you just want to replicate the share command without them having to be in your group. So.. here's this:



ugly_people = [ 'Bob', 'Jeff', 'Joseph', 'Alorn15', 'Steve' ] & checkpcs
ugly_people.each { |person|
fput "give #{person} #{silver.to_i/ugly_people.length}"
}


I believe you have to look at the room for checkpcs to be accurate in your version.

Tillmen
12-13-2009, 07:50 PM
And of course I did that wrong...


;e fput 'wealth'; silver = matchfindword("You have ?"); echo silver
;e fput 'info'; silver = matchfindword("Silver: ?"); echo silver