Code: Select all
sub main()
Var Treetype
Var Treex=0
Var Treey=0
Var Treez=0
Var f=file("records.txt")
repeat:
f.Open()
beginlumberjack:
If NOT f.EOF() Then
Treetype=f.ReadNumber()
Treex=f.ReadNumber()
Treey=f.ReadNumber()
Treez=f.ReadNumber()
UO.Print("Deplacement vers " + str(Treex) + ", " + str(Treey))
Else
goto doitagain
Endif
gotoxy(treex,treey,2)
gotoxy(treex,treey,2)
gotoxy(treex,treey,2)
beginchop:
UO.DeleteJournal()
UO.WaitTargetTile(STR(Treetype),STR(Treex),STR(Treey),STR(Treez))
UO.FindType(0x0F49,0x0000,2)
UO.UseObject("finditem")
UO.Print("Buchage...")
while NOT UO.InJournal("You put the Buches") AND NOT UO.InJournal("Vous abimez l'arbre") AND NOT UO.InJournal("There are no logs") AND NOT UO.InJournal("It appears")
wait(500)
wend
UO.Print("...fin du buchage")
If UO.InJournal("Hetre") then
UO.FindType(0x1bdd,0x05DE,2)
UO.Drop("0",0,0,0,"finditem")
UO.Print("Type de bois ininterressant.")
goto beginlumberjack
Endif
If UO.InJournal("Chene") then
UO.FindType(0x1bdd,0x0974,2)
UO.Drop("0",0,0,0,"finditem")
UO.Print("Type de bois ininterressant.")
goto beginlumberjack
Endif
If UO.InJournal("Pin") then
UO.FindType(0x1bdd,0x03F1,2)
UO.Drop("0",0,0,0,"finditem")
UO.Print("Type de bois ininterressant.")
goto beginlumberjack
Endif
If UO.InJournal("Orme") then
UO.FindType(0x1bdd,0x008D,2)
UO.Drop("0",0,0,0,"finditem")
UO.Print("Type de bois ininterressant.")
goto beginlumberjack
Endif
If UO.Weight>=500 then
goto endlumberjack
Endif
If UO.InJournal("There are no logs here to chop.") OR UO.InJournal("It appears") then
UO.Print("Arbre suivant...")
goto beginlumberjack
Else
UO.Print("Il en reste...")
goto beginchop
Endif
endlumberjack:
UO.Print("Fin du programme de lumberjacking.")
UO.Print("Session epees en bois !")
Var nb_epees
Var loop=1
UO.Exec("automenu Bois Armes")
UO.Exec("automenu Armes Epee")
UO.DeleteJournal()
While loop>=1
UO.Exec("useobject 0x400bd761")
UO.Print("Fabrication...")
UO.DeleteJournal()
while NOT UO.InJournal("You put the Epee") AND NOT UO.InJournal("Vous n'arrivez pas") AND NOT UO.InJournal("You can't make")
wait(500)
wend
UO.FindType(0x1bdd,0x0000,2)
loop=(UO.GetQuantity("finditem"))
UO.Print("Il me reste " +str(loop)+ " buches.")
wend
UO.Exec("cancelmenu")
UO.Print("Delestage...")
UO.FindType(0x0F5E,0x0728,2)
nb_epees=UO.FindCount()
while nb_epees<>0
UO.FindType(0x0F5E,0x0728,2)
nb_epees=UO.FindCount()
UO.Drop("0",0,0,0,"finditem")
Wait(500)
UO.Print("Il reste : " + str(nb_epees) + " a droper")
wend
doitagain:
If f.EOF() Then
f.Close()
UO.Print("Session buchage !")
gotoxy(1967,1659,0)
gotoxy(1967,1697,0)
gotoxy(1908,1756,0)
gotoxy(1864,1795,0)
goto repeat
Else
goto beginlumberjack
Endif
end sub
When the script arrives at the end of the following code, it returns a parse error and stop. I absolutely don't know why. Does a file can't be opened twice in one script ?
Code: Select all
If f.EOF() Then
f.Close()
UO.Print("Session buchage !")
gotoxy(1967,1659,0)
gotoxy(1967,1697,0)
gotoxy(1908,1756,0)
gotoxy(1864,1795,0)
goto repeat