Page 1 of 1

just a little script: sos coords to Automap file...

Posted: 2005-02-11 01:56:37
by klappo
here is it.

Code: Select all

- - - - - - - - - - - - - - - - - - - - - - - - - - -
var f = file("c:\personal.map")
var secure = "0x5869C707"


sub main()
open_file()
empty_bottle()
read_maps()
close_file()
end sub

sub open_file()
f.open()
f.writeln("3")
end sub

sub close_file()
f.close()
end sub

sub read_maps()
while uo.count("0x14ED") > 0
read_put()
write_coord()
wend
end sub

sub write_coord()
var testo = UO.lastgump("text",1)
var coord = ""
for var i = 0 to (STRLEN(testo)-1)
if (testo[i] >= "0") and (testo[i] <= "9") then
coord = coord + testo[i]
end if
if testo[i] == "," then
coord = coord + " "
end if
next

testo = UO.lastgump("text",2)
for i = 0 to (STRLEN(testo)-1)
if (testo[i] >= "0") and (testo[i] <= "9") then
coord = coord + testo[i]
end if
if testo[i] == "," then
coord = coord + " "
end if
next

f.writeln("-point of interest: "+coord+" 1 tesoro")

end sub




sub read_put()
uo.findtype("0x14ED")
UO.useobject("finditem")
wait(500)
UO.LDblClick(154,157)
wait(500)
UO.setreceivingcontainer(secure)
wait(500)
UO.grab(1,"finditem")
wait(500)
UO.unsetreceivingcontainer()
end sub


sub empty_bottle()
while uo.count("0x099F") > 0
uo.usetype("0x099F")
wait(100)
wend
end sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Note: you have to create an empty file BEFORE: "C:\personal.map"
then you can use directly with Automap.



i'm just posting it here 'cause i'm gettin tired to play ultima, and want to save some of my "script - products".

as Sting said

"Walked out this morning
Don’t believe what I saw
A hundred billion bottles
Washed up on the shore
Seems I’m not alone at being alone
A hundred billion casatways
Looking for a home"

Posted: 2005-02-11 22:40:33
by AlexeyVorotnikov
yokofan! wrote:SO guys, i just wanna know how to make a decimal nuber be the most near nondecimal number...


1.1 = 1
1.9 = 2
1.555556=2



thnks

int(x+0.5)

Posted: 2005-02-12 13:28:55
by AlexeyVorotnikov
yokofan! wrote:I have already started mod klappo script, but i stopt at here:

Code: Select all

 coox=mid(coord,1,4)
 gx=mid(coox,1,2)
 mx=mid(coox,3,2)
 mx=mx * 60   --------------------------------   HERE
 coox=gx.mx
 dx=int(coox+0.5)
 tx = dx * 5120 / 360 + 1323


Image

i just want mutyple mx by 60, whats the way to make this? thank u guys


mid function returns a string. You should convert it to number via val function. Like this:

Code: Select all

mx=val(mid(coox,3,2))

Posted: 2005-02-12 18:27:53
by AlexeyVorotnikov
Be aware of type of operands of + operator. If You want use it as string concatenation, You must convert all operands to string form:

Code: Select all

STR(gx) + "." + STR(mx)

Posted: 2005-02-12 23:13:58
by AlexeyVorotnikov
yokofan! wrote:The modd is preatty fishined, now i just want add some things like uo.recall() unless uo.rclick() and uo.moveitem()/uo.ignore() unless uo.grab()/uo.setreceivercontainger() and fix repeation, but i dont know how its loops, can some onde helpme?

i cant see nothink like while or goto... just subs and ifs

There are 3 sorts of loops in Injection scripts:

Code: Select all

while condition
    operators
wend

repeat
    operators
until condition

for i = 0 to 10
    operators
next

Need explanations?

Posted: 2005-02-24 05:17:06
by Goggy
Try

Code: Select all

gxlen= gxlen - gylen 
gxlen= gxlen - mylen