Official ScriptUO EasyUO Scripts > Endless Nights' Script Library

ENs - "Snippets of Code" - 35+ subs.

(1/9) > >>

Endless Night:
Endless Nights Code Snippet Library

All Code in this thread is posted without any license, warranty, etc etc .  Do with it as you will, copy paste modify etc etc.

Be super nice if you posted a credit note.  Inspired by, Using ENS ?? , etc, etc .. not neccessary but nice.   Would be even nicer if you posted any  sweet addons or changes you made Here... Credits will be posted if used.

Enjoy but please dont post in this thread it will only get deleted.  If you wish to post a thank you note, comment, hatemail, review, notes, updates or anything else with reguards to these subs or EN in general please post it here..   


LIST of Subs in this thread in order of posting
CLIENT SWAPPING
FINDING NEW MACROS
Find and Enter An Ant Hole
FIND ANT QUEEN
NEW TARGET SYSTEM ON /OFF
QUEST ITEM TOGGLING
Drop Item on the Ground Around you  (non stacking)
Plants  - Unlock Decorative plants and pickup plant from the ground
Generic Pickup Item/ Type From the ground
COUNT ITEMS IN YOUR BACKPACK/ANY BAG
String Formatting
JOURNAL STRINGS
HIT TRAINING DUMMY
ANTI-IDLE SUB
GENERIC MOVE ITEM/S TO CONTAINER
ENs Siege Perilous ROT TIMER Sub
Ens Hide
ENs Event Macro Gump Open
ENs Get Formatted Date Time
ENs GumpClick
CalculateOverLoadWeight
ENs PadWithSpaces
ENs Type A String
ENs Make a string with spaces
ENs SetVar To String With Spaces
ENs Fill Pitchers From Water Trough
ENs Open Bag / Containor
ENs GetITemWeight
ENs CastSpellOn
ENs FindBag
ENs USeSalvageBag
ENs MoveToContainor
ENs_TrimLeadingAndTrailingSpaces
ENs_DeleteString
Auto Mount When Dismounted Script
ENs -EasyDressing - Equip and Unequip Items from paperdoll
ENs - Load and save data to a file
ENs_FindClosestType
ENs_ReplaceString
save load vars to/from file
ENs_8x8Calculator
ENs_RandomWait
ENs_WhereAmI
ENs_WhatFacetAmIOn
ENs_WhatLandMassAmIOn
ENs_WhereIsThis

Endless Night:
CLIENT SWAPPING
This is the simple but effective sub ive always used for Swapping clients.  (This way you can have more than 2 open and it will still find the rigth client.  Its Pretty fun stuff


--- Code: ---Sub SwapTo  ; CharID
 While #Charid <> %1
   {
   UOXL Swap
   wait 10
   }
Return
--- End code ---

And heres a bit of code to set the Characters.. all ripped from my justice rezzor (its lacking Type checks so if you pick a box as your char it will accept it :) )

--- Code: ---Gosub GetChar Red
set %Red #Result
Gosub GetChar Blue
set %BLue #Result

gosub SwapTo %Blue
halt

Sub GetChar
  display OK Target your %1 Character now
  set #targCurs 1
  while #targCurs = 1
    wait 0
Return #ltargetID
--- End code ---

Endless Night:
FINDING NEW MACROS
IF Skill... look at macro list and find last known number used for a macros.. then scan numbers following until you find it.


If spell .. do simular heres some code to help out


--- Code: ---; Find Spell Macros
set %X 600   ; Set x to some starting number
set %xend    ; set ending number
Repeat
  setuotitle %x
  Event macro 15  %x
  wait 1
  If A in #charStatus
     {
     display ok Got a spell: %x
     wait 10
     }
  set %x %x + 1
Until %x = %Xend
--- End code ---

Endless Night:
Find and Enter An Ant Hole

When next to an anthole --> gosub Ens_EnterAntHole


--- Code: ---Sub ENs_EnterAntHole
   set !oldCharposx #CharPosX
   set !OldCharPosy #CharPosY
   set !EnterHoleTries 5
   If %Antholetypes = N/A
      set %AntHoleTypes PUI_SUI_RVB
   Finditem %AntHoleTypes G_3
   If #Findcnt >= 1
     {
     set #lObjectID #findid
     Repeat
       set !EnterHoleTries !EnterHoleTries - 1
       event Macro 17 0
       Wait 4
     Until #charposx <> !Oldcharposx || #Charposy <> !oldCharposy || !EnterHoleTries <= 0
     }
Return ( #charposx <> !Oldcharposx || #Charposy <> !oldCharposy  )
--- End code ---

Endless Night:
FIND ANT QUEEN

Starting in lower Rigth corner .. this will run around until it finds the queen


--- Code: --- gosub ENs_findAntQueen
halt

sub ENs_FindAntQueen
  If %QueenLoopValueMax = N/A
    gosub SetupQueenLoopValues
  set !queenfound #False
  set !Loopvalue 0
  repeat
    gosub queenmove !loopvalue
    gosub findqueen
  until #result   ; queen found
  wait 5
Return

sub FindQueen
  set #result #false
  finditem OHB G_7
  If #Findcnt > 0
    {
    set !exit 15
    Repeat
      finditem OHB G_7
      Event Pathfind #findx #findy #findz  ; the queen
      wait 1
      set !exit !exit -1
      finditem OHB G_2
    Until !exit < 1 || #findcnt > 0
    set #result #findcnt > 0
    }
Return #Result

Sub QueenMove
    set !x %QueenLoopValuex . %1
    set !y %QueenLoopValuey . %1
    set !z %QueenLoopValuez . %1
    set !Exit 20
    Repeat
      set !Exit !exit - 1
      event pathfind !x !y !z
      wait 1
    Until ( #Charposx = !x && #charposy = !y ) || !exit < 1
    set !loopvalue !loopValue + 1
    If !loopvalue >= %QueenLoopValueMAx
      set !LoopValue 1
REturn

sub SetupQueenLoopValues
  gosub AddQueenloopvalue 5805 1908 3
  gosub AddQueenloopvalue 5803 1896 2
  gosub AddQueenloopvalue 5796 1889 2
  gosub AddQueenloopvalue 5788 1881 2
  gosub AddQueenloopvalue 5779 1872 0
  gosub AddQueenloopvalue 5770 1872 1
  gosub AddQueenloopvalue 5761 1876 0
  gosub AddQueenloopvalue 5755 1885 0
  gosub AddQueenloopvalue 5752 1895 2
  gosub AddQueenloopvalue 5756 1905 2
  gosub AddQueenloopvalue 5759 1910 5
  gosub AddQueenloopvalue 5769 1919 1
  gosub AddQueenloopvalue 5776 1924 3
  gosub AddQueenloopvalue 5780 1931 1
  gosub AddQueenloopvalue 5788 1933 4
  gosub AddQueenloopvalue 5796 1925 2
  gosub AddQueenloopvalue 5805 1915 3
  gosub AddQueenloopvalue 5810 1918 1
  gosub AddQueenloopvalue 5806 1925 3
  gosub AddQueenloopvalue 5799 1930 2
  gosub AddQueenloopvalue 5794 1926 4
  gosub AddQueenloopvalue 5797 1918 3
  gosub AddQueenloopvalue 5790 1913 3
  gosub AddQueenloopvalue 5781 1907 2
  gosub AddQueenloopvalue 5772 1904 1
  gosub AddQueenloopvalue 5764 1897 3
  gosub AddQueenloopvalue 5769 1889 1
  gosub AddQueenloopvalue 5775 1887 4
  gosub AddQueenloopvalue 5782 1894 1
  gosub AddQueenloopvalue 5777 1899 20
  gosub AddQueenloopvalue 5784 1900 0
  gosub AddQueenloopvalue 5789 1906 0
  gosub AddQueenloopvalue 5795 1912 4
  gosub AddQueenloopvalue 5801 1918 2
  gosub AddQueenloopvalue 5803 1916 5
  gosub AddQueenloopvalue 5807 1911 3
Return

sub AddQueenLoopValue
  if %QueenLoopValueMAx = N/A
     set %QueenLoopValueMax 0
  set %QueenLoopValueMAx %QueenLoopValueMax + 1
  set %QueenLoopValuex . %QueenLoopValueMax   %1
  set %QueenLoopValuey . %QueenLoopValueMax   %2
  set %QueenLoopValuez . %QueenLoopValueMax   %3
Return

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version