ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: M4yH3m on January 05, 2020, 07:51:08 AM

Title: Looking for help
Post by: M4yH3m on January 05, 2020, 07:51:08 AM
Hey everyone!! I’m trying to write a script, but I need some guidance. I’ve read the tutorials on here, and they helped somewhat. But what I have in mind, is a little different. I don’t want to put specifics on here, but would love it if an experienced coder could pm me, and maybe we can work together to create the script.
Title: Re: Looking for help
Post by: Crisis on January 05, 2020, 09:23:29 AM
TBH, the best way to get help is to post what you have an let others look at it and help with fixes or suggestions.
Title: Re: Looking for help
Post by: M4yH3m on January 05, 2020, 09:32:57 AM
TBH, the best way to get help is to post what you have an let others look at it and help with fixes or suggestions.

Well, I don’t have anything written just yet, but I will give it a go, and post what I write.
Title: Re: Looking for help
Post by: Endless Night on January 07, 2020, 07:04:27 AM
Hey everyone!! I’m trying to write a script, but I need some guidance. I’ve read the tutorials on here, and they helped somewhat. But what I have in mind, is a little different. I don’t want to put specifics on here, but would love it if an experienced coder could pm me, and maybe we can work together to create the script.

Post what you want to do, its possible it already exists and you just don't know,  or sections of code that you could use already exist.
Title: Re: Looking for help
Post by: M4yH3m on January 07, 2020, 04:33:19 PM
So I want a script for my archer to auto attack a monster that I set up Via a target curser in the beginning of the script.

This is what I have so far. I know its probably not even close to being correct, But I am trying lol.
I'd like to be able to set this so it will attack within 10 tiles of the enemy, but I don't know how to do that yet either.
Any help is very much welcomed.


Code: easyuo
  1. ;==================================
  2. ; Script Name: Mayhem's Auto Attack
  3. ; Author: Mayhem
  4. ; Version: 1.00
  5. ; EUO version tested with: 1.6.0.334
  6. ; Shard OSI
  7. ; Revision Date:
  8. ; Public Release:
  9. ; Global Variables Used: N/A
  10. ; Purpose: Automatically Attacks Selected Target
  11. ;===================================
  12.  
  13. set %hotkey DELETE  ; Pauses Script
  14. set %paused #false
  15. set %Enemy N/A
  16.  
  17. goto Setup
  18.  
  19. Setup:
  20. {
  21.      set #targcurs 0
  22.      set #targcurs 1
  23.  
  24.      event SysMessage Target The Enemy You Wish To Attack
  25.  
  26.      while #targcurs = 1
  27.      {
  28.           wait 1
  29.      }
  30.  
  31.      set %Enemy #ltargetid
  32.      
  33.      event SysMessage Enemy set.
  34.      
  35.      goto Loop
  36. }
  37.  
  38. Loop:
  39. {
  40.      onhotkey %hotkey
  41.      {
  42.          event sysmessage Paused.
  43.          wait 10
  44.          goto Pause
  45.      }
  46.      
  47.      Pause:
  48. {
  49.      set %paused #true
  50.  
  51.      while %paused = #true
  52.      {
  53.         onhotkey %hotkey
  54.         {
  55.             event sysmessage Resumed.
  56.             set %paused #false
  57.             wait 20
  58.             goto Loop
  59.         }
  60.      }
  61. }
  62. Return
  63.  
Title: Re: Looking for help
Post by: Gaderian on January 08, 2020, 07:56:20 AM
Title: Re: Looking for help
Post by: Endless Night on January 09, 2020, 07:33:15 AM
I hate gotos and repeated code so i rewrote your script with no gotos.   And added in an attack function...     This is just an example for you to expand your knowledge with...


Code: [Select]
set %hotkey DELETE  ; Pauses Script
set %paused #false
set %Enemy N/A
 
; Setup:
set #targcurs 0
set #targcurs 1
event SysMessage Target The Enemy You Wish To Attack
while #targcurs = 1
         {
          wait 1
         }
set %Enemy #ltargetid
set %enemykind #ltargetkind
event SysMessage Enemy set.

; main Loop:
repeat
  onhotkey %hotkey
    {
       if %Paused
           {
            event sysmessage Resumed.
            set %paused #false
            wait 20
            }
       else
            {
            event sysmessage Paused.
            wait 10
            set %paused #true
            }
       }
   if ! %Paused
        gosub AttackEnemy
  wait 1
until #charghost = #true    ; repeat until dead.
halt  ; end the script

sub AttackEnemy
   finditem %enemyid G_10   ; find enemy within a radius of 10 from me.
   If #findcnt > 0
     {   ; if found attack it.
     set #ltargetID %enemyid
     set #ltargetkind  %enemykind   
    event maco  ....      ; attackdont rember the event macro numbers.
     }
return
Title: Re: Looking for help
Post by: TrailMyx on January 09, 2020, 07:21:54 PM
I hate gotos and repeated code so i rewrote your script with no gotos.   And added in an attack function...     This is just an example for you to expand your knowledge with...

I miss how GOTOs would make Cerveza's veins in his head nearly burst. lol
Title: Re: Looking for help
Post by: M4yH3m on January 09, 2020, 07:22:55 PM
I hate gotos and repeated code so i rewrote your script with no gotos.   And added in an attack function...     This is just an example for you to expand your knowledge with...

I miss how GOTOs would make Cerveza's veins in his head nearly burst. lol

So I was kind of on the right track?
Title: Re: Looking for help
Post by: Endless Night on January 10, 2020, 09:36:41 AM
I hate gotos and repeated code so i rewrote your script with no gotos.   And added in an attack function...     This is just an example for you to expand your knowledge with...

I miss how GOTOs would make Cerveza's veins in his head nearly burst. lol

So I was kind of on the right track?

It looked like your code would work yes.  You just needed to add attack function.    Finditem offers an easy way to see if something is in a 10 tile radius    G_10  see code in above post
Title: Re: Looking for help
Post by: Endless Night on January 10, 2020, 09:37:30 AM
I hate gotos and repeated code so i rewrote your script with no gotos.   And added in an attack function...     This is just an example for you to expand your knowledge with...

I miss how GOTOs would make Cerveza's veins in his head nearly burst. lol

Gotos make me go bat *bleep* crazy lol  ...  :o