PDA

View Full Version : Repository Down?



Drunken Durfin
12-05-2008, 11:44 AM
So I was going to convert my 5-10 SF hunting script to Lich and decided to download some example to help me hack my way through learning Lich Scripting. Then this happened:

>;repository list
--- Lich: repository active.
Contacting the Lich server... if it's busy, this will take awhile...

Error encountered establishing TCP socket:
No connection could be made because the target machine actively refused it. - connect(2)
--- Lich: repository has exited.


Anyone have a basic, non-poaching, low-level hunting script that I can have a gander at to use as a basis to convert the ones I have?

Thanks.

SpiffyJr
12-05-2008, 11:55 AM
Not really basic but you can learn a lot: http://forum.gsplayers.com/showthread.php?t=31942

stormtov
12-05-2008, 01:34 PM
Here is the very basics of a hunting script. In its current state it does not stance dance between critters swings or run if swarmed. Was mainly written as a script to underhunt critters to skin them. I did try and make it as easy to edit as posible but probably still kinda confusing. Here it is anyway though.

Part 1(this is the bulk of it):

$defend_stance = "defens" #The stance you want to defend in(unlikely to need to change this)
$attack_stance = "offens" #The stance you want to attack in(again unlikely to need to change)
$attack_commands = "get 1 arrow in my quiv,fire" #Input yout attack commands here seperated by commas. For spell casters i recomend using incant.


start_scripts "critter2","aim" #Starts these scripts. Critters 2 is needed, it watches for the critter to die. Aim is a script i sue for my archer, aims at the leg till they fall over then goes for the eye
def defend() #When ever you see "defend()" in the main loop further down this part of the script is called
while checkstance("#{$defend_stance}") == false
fput "stance #{$defend_stance}"
waitfor "You are now in", "Cast Round Time in effect:"
end
end

def attackstance() #When ever you see "attackstance()" in the main loop further down this part of the script is called
while checkstance("#{$attack_stance}") == false
fput "stance #{$attack_stance}"
waitfor "You are now in", "Cast Round Time in effect:"
end
end

def attack() #When ever you see "attack()" in the main loop further down this part of the script is called
$ranaway = false

until $dead == true or $ranaway == true

if checkspell("Sigil of Offense") != true and checkstamina("5") == true and checkmana("5") == true #Before attacking activates the sunfist sigil of offense and defense if they are not currently active
put "Sigil of Offense"
end
if checkspell("Sigil of Defense") != true and checkstamina("5") == true and checkmana("5") == true
put "Sigil of Defense"
end
commands = $attack_commands.split(",") #Here it spilts the attack commands up and stores them in an array
while commands.empty? == false #While there are still items in the array keep going - should work with as many commands as you like, could do a song and dance before every attack if you really wanted
command = commands.shift #Here the ".shift" is removeing the first variable in the array and storing it in "command"
put "#{command}" #Doing said "command"
end #The line below is any kinda of failure message that indicates the critter has left the room, i probably have most of them but could of missed something
result = waitfor "Roundtime", "You currently have no valid target.", "I could not find what you were referring to.", "You do not have a target.", "You do not currently have a target."
if result =~ /^Roundtime: ([0-9]+)/ #Currently the script only works with hardround time, not cast round time or even hasted roundtime. You would have to change here to account for them
sleep $1.to_i #the $1 variable referes to what ever it matched in the expression between the (). So basically it is just getting the number of the roundtime. The ".to_i" is converting it to an integer instead of text. If you are a magic user you will want to tell it to defend() before the sleep command.
else
$ranaway = true #If you didnt get any RT the critter must of left so it notes this and breaks the loop.
break
end



end


end

def getarrow() #When ever you see "getarrow()" in the main loop further down this part of the script is called
fput "gather arrow"
fput "put my arrow in my arrow in my q"
end

def moveing() #Runs groupwalk2 looking for a critter. The script is on the repo, it is the same as groupwalk but edited to work in SF. Wizard records who is in your group, SF does not.
start_script "groupwalk2" #To counter this groupwalk2 assumes those in the room when you start the script are part of your group.
wait_while { running?("groupwalk2") } #Pause untill groupwalk2 ends. Ie. pause untill a critter is found. Can be changed to just use the walk script. This started out as group hunting script
end



loop { #This is the main part of the program. Here you can build up your hunting routine using the above building blocks
until checknpcs == nil
attackstance()
attack()
defend()
if $dead == true #If the critter is dead, as opposed to just runaway, it will skin it. The "$dead" variable is set using the script critters2
start_script "skin"
matchtimeout 1, "You search the"
end
sleep 1
if $ranaway == true #This is again for my archer. If the critter had run away you would still have an arrow in hand that needs to be gotten rid of.
put "put my arr in my arr in my q"
end

getarrow()
$carryon = true #This tells the "critters2" script that it can carry on.
end
moveing()

}

Part 2(this part watches for critters to die, must be run in conjuntion with the above script. Some day i plan to learn to mulithread and combine but this way was a lot easier):


#This script only works in SF as far as im aware. It uses the room window(which updates automatically) to see when the critter has died.

status_tags
loop {
clear
$dead = false
$carryon = false
$critter = matchfindword "? that appears dead"
$dead = true
until $carryon == true
sleep 0.1
end

}

I recomend pasting it into a text editor with syntax highlighting it before trying to make sense of it. I use a program called SciTe, i also know of notepad++. Must be loads more out there though.

edit: Forgot about the script posted above, mine is quite a bit more simplistic then that. I probably did steal some ideas from it too.

Drunken Durfin
12-05-2008, 02:22 PM
Thanks guys, lots of help from both.