Yoko

All sides of Injection
It is currently 2025-12-10 06:52:15

All times are UTC+02:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 2011-07-24 22:30:08 
Offline

Joined: 2010-12-01 08:01:12
Posts: 19
Hi guys, ive got this sorting maps script which works "teoreticaly" fine.
i THINK there is just problem on this part

Code:
while i <= max
bag[i] = "maps_bag_"+str(i)

  while uo.getserial(bag[i]) <> "0x00000000"


as ive got MANY objects called maps_bag_NUMBER (NUMBER is variable of course)
so i need to use them somehow in the script and i thing when i use bag[i] = "maps_bag_"+str(i) then it is concerned as a text, not as a object anymore...

any solution?



Code:
sub maps()

uo.deletejournal()

VAR main_bag = "0x400C2379"

VAR i = 1
VAR max = 16

DIM bag[16] # must be same as VAR max

VAR journal,buffer,exit
VAR map,map_x,map_y

VAR journal_new,buffer_new,exit_new
VAR map_new,map_x_new,map_y_new

VAR search

# savebag
uo.print("Where to put maps?")
uo.addobject("maps_savebag")
while uo.targeting()
  wait(100)
wend


# bag
while i <= max
  uo.addobject("maps_bag_"+str(i))
  while uo.targeting()
    wait(100)
  wend
  i = i + 1
wend


# mapa
uo.print("Choose one map")
uo.addobject("maps_catchmap")
while uo.targeting()
  wait(100)
wend

wait(500)

# zjisti pozici mapy
uo.useobject("maps_catchmap")
while NOT uo.injournal("Map opened to")
  wait(100)
wend

journal = uo.journal(uo.injournal('Map opened to')-1)
 
  # map_x
buffer = ""
exit = 0
i=15
while exit <> 1
  if journal[i] <> ":" then
    buffer = buffer + journal[i]
  else
    exit = 1
  endif
  i = i + 1
wend
map_x = val(buffer)

  # map_y
buffer = ""
exit = 0
while exit <> 1
  if journal[i] <> "" then
    buffer = buffer + journal[i]
  else
    exit = 1
  endif
  i = i + 1
wend
map_y = val(buffer)

search = "Coordinates: "+str(map_x)+"x"+str(map_y)
uo.print(str(search))


i = 1

uo.deletejournal()

while i <= max
bag[i] = "maps_bag_"+str(i)

  while uo.getserial(bag[i]) <> "0x00000000"

    uo.moveitem(bag[i],1,"backpack")
    wait(500)
 
    repeat
   
      uo.findtype("0xFFFF","0xFFFF",bag[i])
      if uo.findcount() > 0 then
   uo.useobject("finditem")

   while NOT uo.injournal("Map opened to")
     wait(100)
   wend

        journal_new = uo.journal(uo.injournal('Map opened to')-1)
 
        # map_x_new
        buffer_new = ""
        exit_new = 0
        i=15
        while exit_new <> 1
          if journal_new[i] <> ":" then
            buffer_new = buffer_new + journal_new[i]
          else
            exit_new = 1
          endif
          i = i + 1
        wend
        map_x_new = val(buffer_new)

          # map_y_new
        buffer_new = ""
        exit_new = 0
        while exit_new <> 1
          if journal_new[i] <> "" then
            buffer_new = buffer_new + journal_new[i]
          else
            exit_new = 1
          endif
          i = i + 1
        wend
        map_y_new = val(buffer_new)

        if ((((map_x - 30) <= (map_x_new)) AND ((map_x_new) <= (map_x + 30))) AND (((map_y - 30) <= (map_y_new)) AND ((map_y_new) <= (map_y + 30)))) then
          uo.moveitem("finditem",1,"maps_savebag")
     wait(500)
        else
       uo.ignore("finditem")
          wait(1000)
   endif
      endif

    until uo.findcount() == 0
 
  wend
  i = i + 1
wend

end sub


Last edited by Shokarta on 2011-07-25 09:39:57, edited 1 time in total.

Top
   
PostPosted: 2011-07-25 01:02:06 
Offline
User avatar

Joined: 2006-12-08 10:51:50
Posts: 718
Location: Москва
Try this
Code:
while i <= max
bag[i] = "maps_bag_"+str(i)

  while uo.getserial(bag[i])


Top
   
PostPosted: 2011-07-25 09:45:29 
Offline

Joined: 2010-12-01 08:01:12
Posts: 19
thanks works fine now....

well another issue is on row 148: Runtime error - Attempting to access array out of bounds (i marked the row in the script for you)

basicly it opens the map i choose, then it moves the first bag[i] as it should, then it should open every map in the bag[i] and by position it should work with the map... but it opens just one map, then the error occurs

which i dont understand why this error occurs, by my opinion it should would...
please have a look at that as im sure im just missing a detail :)

Code:
sub mapy()

uo.deletejournal()

VAR main_bag = "0x400C2379"

VAR i = 1
VAR max = 16

DIM bag[16] # must be same as VAR max

VAR journal,buffer,exit
VAR map,map_x,map_y

VAR journal_new,buffer_new,exit_new
VAR map_new,map_x_new,map_y_new

VAR search

# savebag
uo.print("Where to put maps?")
uo.addobject("maps_savebag")
while uo.targeting()
  wait(100)
wend


# bag
while i <= max
  uo.addobject("maps_bag_"+str(i))
  while uo.targeting()
    wait(100)
  wend
  i = i + 1
wend


# mapa
uo.print("Choose one map")
uo.addobject("maps_catchmap")
while uo.targeting()
  wait(100)
wend

wait(500)

# zjisti pozici mapy
uo.useobject("maps_catchmap")
while NOT uo.injournal("Map opened to")
  wait(100)
wend

journal = uo.journal(uo.injournal('Map opened to')-1)
 
  # map_x
buffer = ""
exit = 0
i = 15
while exit <> 1
  if journal[i] <> ":" then
    buffer = buffer + journal[i]
  else
    exit = 1
  endif
  i = i + 1
wend
map_x = val(buffer)

  # map_y
buffer = ""
exit = 0
while exit <> 1
  if journal[i] <> "" then
    buffer = buffer + journal[i]
  else
    exit = 1
  endif
  i = i + 1
wend
map_y = val(buffer)

# search = "Coordinates: "+str(map_x)+"x"+str(map_y)
# uo.print(str(search))


i = 1

uo.deletejournal()

while i <= max
bag[i] = "maps_bag_"+str(i)

  while uo.getserial(bag[i])

    uo.moveitem(bag[i],1,"backpack")
    wait(500)
    uo.useobject(bag[i])
    wait(500)
 
    uo.findtype("0x14EB","0x0000",bag[i])

    while uo.findcount() > 0
   
      if uo.findcount() > 0 then
   uo.useobject("finditem")

   while NOT uo.injournal("Map opened to")
     wait(100)
   wend

        journal_new = uo.journal(uo.injournal('Map opened to')-1)
 
        # map_x_new
        buffer_new = ""
        exit_new = 0
        i = 15
        while exit_new <> 1
          if journal_new[i] <> ":" then
            buffer_new = buffer_new + journal_new[i]
          else
            exit_new = 1
          endif
          i = i + 1
        wend
        map_x_new = val(buffer_new)

          # map_y_new
        buffer_new = ""
        exit_new = 0
        while exit_new <> 1
          if journal_new[i] <> "" then
            buffer_new = buffer_new + journal_new[i]
          else
            exit_new = 1
          endif
          i = i + 1
        wend
        map_y_new = val(buffer_new)

        if ((((map_x - 30) <= (map_x_new)) AND ((map_x_new) <= (map_x + 30))) AND (((map_y - 30) <= (map_y_new)) AND ((map_y_new) <= (map_y + 30)))) then
          uo.moveitem("finditem",1,"maps_savebag")
     wait(500)
        else
       uo.ignore("finditem")
          wait(1000)
   endif

148:     uo.findtype("0x14EB","0x0000",bag[i])
      endif
 
    wend

  wend
  i = i + 1

wend

uo.moveitem("finditem",1,"maps_savebag")
uo.ignorereset()

end sub


Top
   
PostPosted: 2011-07-25 10:34:20 
Offline
User avatar

Joined: 2006-12-08 10:51:50
Posts: 718
Location: Москва
Thats easy... Work with the journal, changing the value of i
Code:
i = 15 
        while exit_new <> 1
          if journal_new[i] <> ":" then
            buffer_new = buffer_new + journal_new[i]
          else
            exit_new = 1
          endif
          i = i + 1
        wend
        map_x_new = val(buffer_new)

          # map_y_new
        buffer_new = ""
        exit_new = 0
        while exit_new <> 1
          if journal_new[i] <> "" then
            buffer_new = buffer_new + journal_new[i]
          else
            exit_new = 1
          endif
          i = i + 1
        wend
        map_y_new = val(buffer_new)
You need to define a new variable, which will work with bags only


Top
   
PostPosted: 2011-07-25 10:48:02 
Offline

Joined: 2010-12-01 08:01:12
Posts: 19
thanks, how could i miss that im using VARIABLE i not only for bags but for the journal as well :)

script works fine, thanks man


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited