Yoko

All sides of Injection
It is currently 2024-04-28 10:03:25

All times are UTC+02:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
 Post subject: little help with objects
PostPosted: 2008-01-05 21:13:55 
Offline

Joined: 2006-11-02 14:07:13
Posts: 29
Location: near Cologne, GERMANY
hi to all,

i try to get the "name" of an object. Not the name of an character. this is easy with getname.

but how can i get something like: "1000 Eichenstämme"

i tried:

Code:
sub testen()
    UO.FindType("0x0190", "-1", 'ground')
    if uo.FindCount() then
       uo.print(uo.getname('finditem'))
    else
       uo.print("no item around")
    endif
end sub


but this won't work.

please is there anybody who can help me?

thanks
taya


Top
   
 Post subject:
PostPosted: 2008-01-05 21:19:19 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
Code:
sub testen() 
    UO.FindType("0x0190", "-1", 'ground')
    if uo.FindCount() then
       uo.print(str(uo.getQuantity('finditem'))+' '+uo.getname('finditem'))
    else
       uo.print("no item around")
    endif
end sub


Top
   
 Post subject:
PostPosted: 2008-01-06 14:33:25 
Offline

Joined: 2006-11-02 14:07:13
Posts: 29
Location: near Cologne, GERMANY
thanks.

but unfortunately is says only

"60000"

instead of

"60000 Eichenhoelzer".

if i use this with a char then is says something like

"0 Hontar Hugmool".

thus, again my question:

how can i get the "name" of an object? or should i say description or property?

the reason is that i want to chance my lootscript. some object on our shard are named like "[magic] garment". and i will loot all this "[magic]" items too.

so i will insert something like

Code:
if "[magic]" in getproperty(finditem) then
   gosub loot()
endif


thanks
taya

PS: sorry i'm more familiar with easyUO but for lootscripts i think injection is the much better solution. in easyUO it's the command "event property #findid"


Top
   
 Post subject:
PostPosted: 2008-01-06 15:45:18 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
Code:
sub testen() 
    UO.FindType("-1", "-1", 'ground')
    if uo.FindCount() then
       if not uo.getname('finditem') then
         uo.click('finditem')
          wait(100)
       end if
      if InStr(uo.getname('finditem'), "[mag]") > 0 then
         uo.print("Get it")
      end if
    else
       uo.print("no item around")
    endif
end sub
sub InStr(Source, subStr)
   var n = len(subStr)
   var j
   for var i = 0 to len(Source)-n
      j = 0
      while (j < n) and (Source[i+j] == subStr[j])
         j = j+1;
      wend
      if j == n then
         return i
      end if
   next
   return -1
end sub


Top
   
 Post subject:
PostPosted: 2008-01-06 17:08:11 
Offline

Joined: 2006-11-02 14:07:13
Posts: 29
Location: near Cologne, GERMANY
super!

thanks!

aber i chanced the line

if InStr(uo.getname('finditem'), "[mag]") > 0 then

to ">= 0" it works perfekt!

greats
taya


Top
   
 Post subject:
PostPosted: 2008-01-06 18:03:29 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
:) no problem:)


Top
   
PostPosted: 2014-03-17 21:07:57 
Offline
User avatar

Joined: 2012-12-15 12:03:25
Posts: 119
Location: C-Петербург
Нужна проверка на длину подстроки, иначе может не работать.

Code:
sub InStr(Source, subStr)
   var n = len(subStr)
   var j

if len(Source)>=len(subStr) then
   
   for var i = 0 to len(Source)-n
      j = 0
      while (j < n) and (Source[i+j] == subStr[j])
         j = j+1;
      wend
      if j == n then
         return i
      end if
   next
else
end if
   return -1
   
end sub


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 34 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:  
Powered by phpBB® Forum Software © phpBB Limited