Page 1 of 1

[HELP] I Need script for target

Posted: 2009-09-18 11:11:35
by Azt
Hi!

I need a script that if I Say "Destroyer" in game, or Destr, or Des, the script search a player called like that ad add it to objects.

it's possible?

Posted: 2009-10-05 21:28:08
by CuHTpoH
before start scripts delete journal text with destr by uo.deletejournal() or by deljournal() (custom func, find it in this forum, also find checklag())
...
if uo.injournal('des') then
...

check that Track world items is ON
find players (0x0190 and 0x0191) on the ground
click and get their names
use 2 funcs -

Code: Select all

sub getnam(id)
   var timez,t1="World save has been initiated"
   deljournal(t1)
   if uo.getname(id)=='' then
      uo.click(id)
      timez=uo.timer()+10
      while timez>uo.timer() and uo.getname(id)==''
         if uo.injournal(t1) then
            deljournal(t1)
            checklag()
            timez=uo.timer()+10
         endif
         wait(100)
      wend
      if timez<uo.timer() then
         return false
      endif
   endif
   return uo.getname(id)
endsub


Code: Select all

# finds one string in another
; int findentry( string, string )
; entry - what we seek for
; str - in which string
sub findentry(entry,str)
   var i
   for i=0 to strlen(str)-strlen(entry)
      if mid(str,i,strlen(entry))==entry then
         return i
      endif
   next
   return -1
endsub


so if findentry() gives number bigger than -1 - there is des in name, than get it's serial

Re: [HELP] I Need script for target

Posted: 2009-10-05 23:00:06
by Nmy
Azt wrote:Hi!

I need a script that if I Say "Destroyer" in game, or Destr, or Des, the script search a player called like that ad add it to objects.

it's possible?


I would search the journal, get the serial and set laststatus/lastattack/lasttarget with this serial so you can attack imediatly.
To filter it from regular speech you can make it work using some symbol - for example
:Nickname - would trigger the script.

Why do you need such thing anyway? For PvP? That's a lame pvp if you ask me.

Posted: 2009-10-06 07:57:53
by CuHTpoH
indeed it is

Posted: 2009-10-06 13:32:16
by Azt
Sub Checklag()
deljournal('a backpack')
uo.click('backpack')
repeat
wait(50)
until uo.injournal('a backpack')
endsub

Sub deljournal(msg)
while uo.injournal(msg)
uo.setjournalline(uo.injournal(msg)-1,"")
wend
endsub

found this!

thanks

Posted: 2009-10-06 14:19:12
by CuHTpoH
Try to never use wait(X) where X<100
MUCH bigger chance of crash or unhandled exception in parser

Posted: 2009-10-06 14:21:42
by CuHTpoH
string of check will be like that:
IF uo.findentry('Destroyer',getnam(uo.getserial('finditem'))) then