ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: tandj99 on January 13, 2017, 09:48:24 AM

Title: Multi client targeting
Post by: tandj99 on January 13, 2017, 09:48:24 AM
Looking for a simple shared target for my tamers   So when im on my main account i can say all kill my will attack and then the other follow suit as of right now i cant seem to get it to work .I know im missing something some where Little Point in right direction.

this is what i have  If yall know a better way let me know thx

;=========== MAINCODE =============
sub main
while #true
{
  onhotkey F9
    gosub TargetCursor
  onhotkey F11
    gosub attack
}
return
;==================================
sub TargetCursor
event macro 13 1
target 20
until #targcurs = 1
set #ltargetid #findid
set #ltargetkind 1
event macro 22 0
}
wait 20
uoxl swap
}
return
;==================================
Title: Re: Multi client targeting
Post by: manwinc on January 13, 2017, 11:03:21 AM


Code: [Select]
sub TargetCursor
event macro 13 1
target 20
until #targcurs = 1

Need a repeat or the Until #Targcurs = 1 line does nothing.

Code: [Select]
Sub TargetCursor
Repeat
event macro 13 1
target 20
until #targcurs = 1

Title: Re: Multi client targeting
Post by: tandj99 on January 13, 2017, 12:09:55 PM
Ok with the repeat it is bring up cursors now. thank you   But when i hit the hot key for attack i see the other Client saying all kill but the pet is not attacking ?
Am i missing something. Is there a way to write it where Only the curse target from char a will share over to char b  .. So far this is kinda working just im missing something ive looked over a few attack scripts and just not finding what i am missing  :-[
onhotkey F9
    gosub TargetCursor
  onhotkey F10
    gosub attack
}
return

;==================================
sub TargetCursor
msg All kill$
repeat
until #targcurs = 1
set #ltargetid #findid
set #ltargetkind 1
event macro 22 0
}
wait 20
uoxl swap
}
return
;==================================
sub attack
msg All Kill$
 wait 5
 event macro 22 0
 }
return
Title: Re: Multi client targeting
Post by: BobOzarius on January 13, 2017, 12:12:31 PM
That wait 20 you have in there is not very efficient for multi client scripting. Since you're swapping, there's no real need to wait after the attack, just set a timer for that client, which is about the speed you can attack at on multiple clients, and swap, and when you return to that client, check the timer to see if it's up again, and you're able to attack. The whole time, checking for spawn, and monsters you can attack with your pet. Including people. I wrote this very quickly, but it should constantly update your target with either the monster your clients are attacking, or once that monster is dead, it will attack a new monster. Not sure it works, haven't tested, but it's close. To be complete, you probably should set your #ltargetkind also. I'm just a noob and always forget to do that until it messes up.

Code: [Select]
set %targets ;Put target types here
set %range 10
for %i 1 #cliCnt
{
  set %attackTimer . #charid #systime
  set %targetFoundTimer . #charid #systime
}
repeat
    set %targetFound n/a
    set %target1 n/a
    finditem %targets g_ , %range
    if #findcnt > 0
    {
      for #findindex 1 #findcnt
      {  
        if #findid = %target
        {
          if %targetFoundTimer . #charid < #sysTime
            set %targetFoundTimer . #charid #systime + 10000
          set %targetFound #findid
          break
        }
        set %target1 #findid
      }
    }
    if %target1 <> n/a
      set %target %target1
    if %targetFound <> n/a
      set %target %targetFound
    else
      set %targetFoundTimer . #charid #sysTime - 1
  for %i 1 #clicnt
  {
    if %target <> n/a && %attackTimer . #charid < #systime && %targetFoundTimer . #charid < #systime
      gosub attackTarget
    uoxl swap
  }
until #false

sub attackTarget
  msg $all kill$
  set #ltargetid %target
  target 1s
  event macro 22
  if %targetFound <> n/a && %targetFoundTimer . #charid < #systime
    set %targetFoundTimer . #charid #systime + 10000
  set %attackTimer . #charid #systime + 1000
return
Title: Re: Multi client targeting
Post by: tandj99 on January 13, 2017, 01:00:43 PM
thXS bob  Ill see what i can do with that  .I honestly I like the hot key function myself.. That way i dont have to set just one type and have to change it all the time.
Title: Re: Multi client targeting
Post by: BobOzarius on January 13, 2017, 02:13:33 PM
Why set one type? Why not put all types in it?  You can put in decision making to determine what to attack based on whatever you like. I like everything to be auto. There's no reason you can't add a target and auto button. Auto ON. Auto OFF. Target ON. Target OFF. The %targets variable can hold more than one type. Put in 100 types. The way I wrote this, it should attack a monster every second, unless the monster is still there when the attack timer is up, then it should set a timer for 10 seconds, but keep checking if the same monster is still there, and only reattack every 10 seconds, and if it dies, then it will refind another monster to attack. Or should anyways. That was the plan when I started writing it. And it should attack on all your open clients.
Title: Re: Multi client targeting
Post by: tandj99 on January 13, 2017, 02:18:57 PM
true Ive tried this ... i  need the hot key one cause i run with a tamer with luck and the rest without and i need my main to do most damage  so i could say all kill then after 1 min tell the others on hot key too kill
Title: Re: Multi client targeting
Post by: BobOzarius on January 13, 2017, 03:39:31 PM
So on a new monster, set a timer to have the #clinr of that client attack first, and set a timer to have the other clients attack 10 seconds after or something.  Should be very easy to do.

if #charid = %characterWithLuck && %attacktimer . #charid < #sysTime && %targetfound = #false... or something similar. Then have that character attack, and set a however many second timer you want to keep the other clients from attacking until that timer is up and the same monster is still found.  Shouldn't be too difficult. Then it will only attack with multiple clients if the monster lives long enough too. Tons of ways to do it easily.
Title: Re: Multi client targeting
Post by: The Ghost on January 13, 2017, 04:18:12 PM
You guy love the client swap,  let me suggest other option, call namespace Global.   With this you can pass any king of information inside the same EasyUO. 

here something you can read http://www.scriptuo.com/index.php?topic=1130.0   to help you out. 
Title: Re: Multi client targeting
Post by: BobOzarius on January 13, 2017, 06:55:07 PM
Please show me an example of global namespace that is faster than the swapping code above and does the same thing. I'd like to see it if you have one.

You guy love the client swap,  let me suggest other option, call namespace Global.   With this you can pass any king of information inside the same EasyUO. 

here something you can read http://www.scriptuo.com/index.php?topic=1130.0   to help you out. 
Title: Re: Multi client targeting
Post by: gruntman on January 14, 2017, 07:50:07 PM
Please show me an example of global namespace that is faster than the swapping code above and does the same thing. I'd like to see it if you have one.

You guy love the client swap,  let me suggest other option, call namespace Global.   With this you can pass any king of information inside the same EasyUO. 

here something you can read http://www.scriptuo.com/index.php?topic=1130.0   to help you out. 

Have a look at the link Ghost provided..It will give you your peek into how it works.
Title: Re: Multi client targeting
Post by: BobOzarius on January 14, 2017, 10:18:33 PM
     Maybe I wasn't clear. I'd like to see an example because I'm very sure namespace isn't going to be the best option in this situation. Gbot won't show me anything new I don't know about namespaces. Assuming that Ghost thinks uoxl swap is a bad idea, then he must be saying that using multiple scripts with global namespaces, on each individual client, is a better option. I don't agree. Namespaces are a bit slow at transferring data. But if he can show me an example that proves his point, that applies to the original posters needs, I'll be happy to check it out and see if he's right. The op did ask for help. I can rewrite it with globals and multiple scripts if you'd like to compare. But I was hoping Ghost would prove his point with some code. For the benefit of the original poster.

     Say you have 5 accounts, and you're using one account to transfer info to each of the other 4 accounts with namespace globals, there is a slight pause in the transfer of data to the global namespace, and when other scripts in other tabs can read it that isn't present when you swap. Swapping is very speedy. And when you set a standard variable in easyuo, it's available immediately to any other client that you swap to, no namespace "lag." I think it all depends on the number of clients too, because there is a slight lag between the time it takes to swap between the first client and back around to the first client. If you're using 10 clients, namespace might be better. 6 or under? Swap is the way to go. If  you look at the example I posted, you'll see why it's a better option I think. Also it assumes he's moving the clients around manually using 1 mouse and each separately. Using my way they'd have to stay on screen with each other. I could edit it to make that not necessary pretty easily though. Tandj wasn't too clear on what he wanted it to do. So I just threw something together. If you have a better idea with namespaces though, I'm sure tandj would appreciate seeing multiple options.
Title: Re: Multi client targeting
Post by: The Ghost on January 15, 2017, 06:50:18 AM
Not saying that my way is better or faster.    But when you have to pass target  and control to 3 to 5 characters the namespace global  make it easier.    I utilize  this for PvM build.  This way I only have one screen to pay attention and one menu that perform all the action.   I use the G-Bot basic function  and build what I need him to do.    If I hunt with my Sammy, tamer and  mage  or with the army ( character) all the task are pass via global.   IF this the best way to do it,  I can't tell you because I haven't try the swap client.  I learn one way and choice that road.   I can tell you that since I learn about the namespace global, it had make my life easier to multi client and kept them a life. 

 I agree with BobOzarius  that I have a slight delay in some action, but at the end,  they all come out one after an other.
Title: Re: Multi client targeting
Post by: BobOzarius on January 15, 2017, 08:07:22 AM
Until you prove it with code, it's still just your opinion that namespace is better with 3 to 5 clients. Consider this the challenge to prove it with script.  ;)  I'd like to see how you'd do it.
Title: Re: Multi client targeting
Post by: TrailMyx on January 15, 2017, 10:09:23 AM
*somewhere in the distance, TM hears a gaunlet crash to the stone floor!*
Title: Re: Multi client targeting
Post by: tandj99 on January 15, 2017, 10:15:33 AM
Ok guys This is what i have and works right now No auto swap what so ever If i Load this up for each client it works great and the way i want to . But i want to try to cut it down to just 1 open page any ideas ?

 set #lpc 1000
 set %target CD_
 ;; Oaks:: WH_XI_SH_SC_EF_NB_RC_PB :: Pixies, Shadow Wisps, Kirins, Unicorns
;; Mephitis:: UE_SD_K_J_U_HD_PD_EJ_UI  :: Scorpions, Giant Spiders, Terathan Warriors, Terathan Drones, Dread spiders, Matriarch, Avengers, PEs
;; Niera:: II_WI_TI_YD_WD_NI_EB_VI_NI_R :: Mummies, Skeletal Knights, Wraiths, Spectres
;; Semidar:: W_BE_UC_UD_YH_N_FD_HI :: Imps, Mongbats, gargoyles, harpies, burning gargs, stone gargs
;; Rikktor:: QE_AE_DE_FE_AB_QF_XE_YE_X_DF_CD_DI :: Lizardmen, Snakes, Lava lizards, ophidian warriors, Dragons, Ophidian Avengers
;; Baracoon:: XF_VE_IE_OE_HE_LD_BI_RB_UB_GB_LB_FB_CI ::
 set %timeout 25
repeat
  onhotkey q
    gosub Kill

sub Kill
findItem %target G_8 ;
if #findCnt < 1
   {
   }
    set #ltargetID #findID
    set #ltargetKind 1
    Msg all kill$
   wait 1s
    target
    event macro 22 0 ; last target
    wait 5
    return
Title: Re: Multi client targeting
Post by: The Ghost on January 15, 2017, 10:47:41 AM
Until you prove it with code, it's still just your opinion that namespace is better with 3 to 5 clients. Consider this the challenge to prove it with script.  ;)  I'd like to see how you'd do it.

I never said that my way is better,  I only seen swap client for only 2 clients atm.     So to control 3 I decide to use global, since it was faster for me to setup and control.  I don't need to sale my idea,  was just giving other suggestion.   For my  play style and what I do, this  work well for me.  
Title: Re: Multi client targeting
Post by: TrailMyx on January 15, 2017, 10:52:20 AM
Until you prove it with code, it's still just your opinion that namespace is better with 3 to 5 clients. Consider this the challenge to prove it with script.  ;)  I'd like to see how you'd do it.

As far as the "how", this is the framework that Ghost is talking about from our long lost Cerveza:

http://www.scriptuo.com/index.php?topic=1130.msg8916#msg8916
Title: Re: Multi client targeting
Post by: BobOzarius on January 15, 2017, 01:32:36 PM
Until you prove it with code, it's still just your opinion that namespace is better with 3 to 5 clients. Consider this the challenge to prove it with script.  ;)  I'd like to see how you'd do it.

As far as the "how", this is the framework that Ghost is talking about from our long lost Cerveza:

http://www.scriptuo.com/index.php?topic=1130.msg8916#msg8916

I was around in 2009 when Cerveza posted that TM. I just haven't played UO much since.  I guess no one is up for a coding challenge!   :'(  I think I might just have to write tandj a script to do it for him.  If you'd like a bit more help tandj just say the word, and I'll whip you up something that will work for you pretty well. I have tamer accounts so I should be able to make something that attacks on the luck character and waits to send in the non luck clients easily. Personally I'd probly just keep those clients unpartied, so the one character gets high luck drops, and the others get low and mid range luck drops. What are you killing? It shouldn't be hard to make it auto attack and target attack friendly either. Using swap of course. The script above should do most of that. But I didn't know at the start you needed one client to attack first.
Title: Re: Multi client targeting
Post by: tandj99 on January 15, 2017, 02:23:29 PM
Its More for big bosses and what not Im still key on that Hotkey  ... Just tab bit easy to sick A Greater dragon (tank)  then the others afterwards. If u want to set something up Plz do.This code i just posted works! just have 4 of them open while on the main ...