[EasyUO] Mining HUD 1.02

If you make a Client-side script you can publish it here for other players to use
Locked
Penny
Legendary Scribe
Posts: 210
Joined: Thu Oct 01, 2009 12:05 pm

[EasyUO] Mining HUD 1.02

Post by Penny »

Point-and-click Miner

NOTE: still fixing it up, feel free test it out :) oh, and do expect bugs here and there

Also, feel free to share any ideas about what should be added.

Moar notes:
- Doesnt work inside mines yet, go to a mountain side
- use 800x600 resolution on your gameplay window

New in 1.02:
- Minimize button (the yellow one in the corner)
- Adds granite to stone keys if you have them
- Colors veins so you can see where old one ends and new begins

How to get started

1) You need a shovel, portable forge and metal keys in your backpack
2) start script, move the script window over the game window so that the red circle
aims at your feet
3) press setup button, it'll look for the shovel, forge etc.
4) press scan button, a series of smaller buttons will appear on the HUD
5) clicking one of the small buttons will do something depending on their color:

blue - spawns small green/[other color] buttons
green - moves there
[other color] - mines there if it's close enough

On the side, there are more buttons:

Scan - If screen is empty, it'll scan the area and spawn blue buttons
Wipe - Will empty the screen
Smelt - smelts ore
Keys - Adds ingots and granite (if you have stone keys) to keys
Setup - This is the button you need to press first, otherwise nothing will happen

The editable number - defines the "rate of mining", 20 is good, a bit more if laggy, 15 is pretty much minimum.

I hope I didn't forget anything...

Code: Select all

; version - 1.02
tile init

set %delta 23
set %halfdelta 11
set %veinEmptyMsg no_metal_here
set %miningFailMsg You_loosen_some_rocks
set %miningSuccessMsg ore_in_your_backpack
set %cantMineMsg mine_there
set %cantseeMsg Target_cannot_be_seen
set %tooFarMsg too_far_away
set %backpackfullMsg your_backpack_is_full

set #lpc 1000
menu font bgcolor green
menu window size 900 600
menu window transparent 70
menu shape targetCircle 385 285 30 30 1 2 1 red 2 red

menu button rawScan 820 50 80 30 Scan
menu button wipeGrid 820 90 80 30 Wipe
menu button smelt 820 130 80 30 Smelt
menu button keys 820 170 80 30 Keys

menu font bgcolor red
menu button setup 820 210 80 30 Setup

menu font bgcolor yellow
menu text miningWaitText 820 250 Mining speed
menu edit miningWait 835 270 50 20

menu button minimize 0 0 20 20
set %minimized #false

menu show

set #menubutton none

while #true
{
 if #menubutton = setup
 {
  set #menubutton none
  gosub setup
  while #true
  {
   if #menubutton = minimize
   {
    set #menubutton none
    gosub minimize
   }
   if #menubutton = Smelt
   {
    set #menubutton none
    gosub smelt
   }
   if #menubutton = keys
   {
    set #menubutton none
    gosub keys
   }
   if #menubutton = rawScan
   {
    set #menubutton none
    gosub rawScan #menures
   }
   if #menubutton = wipeGrid
   {
    set #menubutton none
    gosub wiperawGrid
    gosub wipesmallGrid
   }
   if rawGrid in #menubutton
   {
    str mid #menubutton 8 6
    set #menubutton none
    gosub wipesmallGrid
    gosub smallGrid #strres
   }
   if smallGrid in #menubutton
   {
    str mid #menubutton 10 6
    set #menubutton none
    gosub wipesmallgrid
    gosub wipeRawgrid
    gosub handleSpot #strres
    gosub rawScan
   }
  }
 }
}
halt

sub minimize
{
 if %minimized
 {
  menu window size 900 600
  set %minimized #false
 }
 else
 {
  menu window size 20 20
  set %minimized #true
 }
 return
}
sub handleSpot
{
 set %string %1
 str pos %string y
 set %ypos #strres + 1
 set %len %ypos - 3
 str mid %string 2 %len
 set %smallx #strres
 str mid %string %ypos 2
 set %smally #strres


 set %x %rawx * 5 + %smallx
 set %y %rawy * 5 + %smally
 if ( abs %x <= 1 && abs %y <= 1 )
 {
  gosub handleClose %x %y
 }
 else
 {
  set %x #charposx + %x
  set %y #charposy + %y
  tile get %x %y 1
  set %flag #tileflags
  tile get %x %y 2
  set %name #tilename
  if ( impassable notin %flag ) && ( tree notin %name )
  {
   event pathfind %x %y #tilez
   set #lpc 10
   while ! ( #charposx = %x && #charposy = %y )
         wait 1
   set #lpc 1000
  }
 }

 return
}

sub handleClose
{
 set %spotX #charposx + %1
 set %spotY #charposy + %2
 tile get %spotX %spotY 1
 if impassable notin #tileflags
 {
  event pathfind %spotX %spotY
  set #lpc 10
  while ! ( #charposx = %spotX && #charposy = %spotY )
       wait 1
  set #lpc 1000
  return
 }
 else
 {
  set #lpc 10
  set %spotZ #tileZ
  set #lobjectid %shovelid
  set #ltargetx %spotX
  set #ltargety %spotY
  set #ltargetz %spotZ
  set #ltargetkind 2
  set %stillMining #true
  while %stillMining
  {
   event macro 17
   target
   event macro 22
   menu get miningWait
   wait #menures
   gosub lookForStop
  }
  gosub smelt
 }
 set #lpc 1000
 return
}

sub lookForStop
{
 set %jInd #jindex + 2
 for %i #jindex %jind
  {
   scanjournal %i
   if ( ( %veinEmptyMsg in #journal ) || ( %cantMineMsg in #journal ) || ( %cantseeMsg in #journal ) || ( %toofarMsg in #journal ) || ( %backpackfullMsg in #journal ) )
   {
    set %stillMining #false
    return
   }
  }
  return
}
sub smelt
{
 smelt_start:
 set #lpc 10
 finditem DWJ C_ , #backpackid
 if #findcnt > 0
 {
  for %i 1 #findcnt
  {
   set #findindex %i
   set #lobjectid #findid
   event macro 17
   target
   set #ltargetid %forgeID
   set #ltargetkind 1
   event macro 22
   wait 5
  }
 }
 finditem DWJ C_ , #backpackid
 if #findcnt > 0
    goto smelt_start
 set #lpc 1000
 return
}

sub keys
{
 set #lpc 10
 finditem ENK C_ , #backpackid
 if #findcnt > 0
 {
  set #lobjectid %keyID
  event macro 17
  while #contsize <> 505_270
        wait 3
  set %x #contposx + 294
  set %y #contposy + 233
  click %x %y
  target
  for %i 1 #findcnt
  {
   set #findindex %i
   set #ltargetid #findid
   set #ltargetkind 1
   event macro 22
   target
  }
  set %x #contposx + 294
  set %y #contposy + 233
  click %x %y r
  key esc
 }
 finditem BVI C_ , #backpackid
 if #findcnt > 0 && %stoneKeyID <> none
 {
  set #lobjectid %stonekeyID
  event macro 17
  while #contsize <> 505_270
        wait 3
  set %x #contposx + 294
  set %y #contposy + 233
  click %x %y
  target
  for %i 1 #findcnt
  {
   set #findindex %i
   set #ltargetid #findid
   set #ltargetkind 1
   event macro 22
   target
  }
  set %x #contposx + 294
  set %y #contposy + 233
  click %x %y r
  key esc
 }
 set #lpc 1000
 return
}

sub setup
{
 ;find shovel
 finditem TWF C_ , #backpackid
 if #findcnt > 0
 {
  set %shovelID #findid
 }
 else
 {
  event exmsg #charid 3 33 No shovel found! stopping!
  halt
 }
 ;find forge
 finditem SMF C_ , #backpackid
 if #findcnt > 0
 {
  set %forgeID #findid
 }
 else
 {
  event exmsg #charid 3 33 No forge found! stopping!
  halt
 }
 ;findkeys
 set %keyID none
 set %stoneKeyID none
 finditem NUI C_ , #backpackid
 if #findcnt > 0
 {
  for %i 1 #findcnt
  {
   set #findindex %i
   event property #findid
   if metal in #property
   {
    set %keyID #findid
   }
   if stone in #property
   {
    set %stonekeyID #findid
   }
  }
 }
 if %keyID = none
 {
  event exmsg #charid 3 33 No keys found! stopping!
  halt
 }
 menu font bgcolor green
 menu button setup 820 210 80 30 Setup
 return
}

sub smallGrid
{

 set %string %1
 str pos %string y
 set %ypos #strres + 1
 set %len %ypos - 3
 str mid %string 2 %len
 set %rawx #strres
 str mid %string %ypos 2
 set %rawy #strres

 for %i -2 2
 {
  for %j -2 2
  {
   set %x %i + %rawx * 5
   set %y %j + %rawy * 5
   gosub XYtoM %x %y
   if ( ( %mx <= 790 && %mX >= 0 ) && ( %mY <= 590 && %mY >= 0 ) )
   {
    set %tilex #charposx + %x
    set %tiley #charposy + %y
    tile get %tilex %tiley 1
    if impassable in #tileflags
    {
     set %colorX ( %tileX / 6 ) % 2
     set %colorY ( %tileY / 6 ) % 2
     if %colorX = 1 && %colorY = 1
        set %bgColor $FF00FF
     if %colorX = 0 && %colorY = 1
        set %bgColor $00FFFF
     if %colorX = 1 && %colorY = 0
        set %bgColor $FFFF00
     if %colorX = 0 && %colorY = 0
        set %bgColor $0000FF
     menu font bgcolor %bgColor
    }
    else
    {
     menu font bgcolor green
    }
    set %menubutton smallgridx , %i , y , %j
    menu button %menubutton %mX %mY 10 10
   }
  }
 }
 return
}

sub wipeSmallGrid
{
 for %i -2 2
 {
  for %j -2 2
  {
   set %menubutton smallgridx , %i , y , %j
   menu delete %menubutton
  }
 }
 return
}

sub rawScan
{
 set %type %1
 gosub wipeRawGrid
 menu font bgcolor blue
 for %i -3 3
 {
  for %j -3 3
  {
   set %x %i * 5
   set %y %j * 5
   gosub XYtoM %x %y
   if ( ( %mx <= 790 && %mX >= 0 ) && ( %mY <= 590 && %mY >= 0 ) )
   {
    set %buttonname rawGridx , %i , y , %j
    menu button %buttonname %mX %mY 10 10
   }
  }
 }
 gosub smallgrid x0y0
 return
}

sub XYtoM
{
 set %mX 400 + %1 * %delta - %2 * %delta - 5
 set %mY 300 + %1 * %delta + %2 * %delta - 5
 return
}

sub wipeRawGrid
{
 for %i -3 3
 {
  for %j -3 3
  {
   set %buttonname rawgridx , %i , y , %j
   menu delete %buttonname
  }
 }
 return
}
Last edited by Penny on Thu Jan 20, 2011 3:57 am, edited 3 times in total.
Failure is not an option, it's a standard.
krystol
Elder Scribe
Posts: 133
Joined: Tue Oct 12, 2010 12:07 am

Re: [EasyUO] Mining HUD

Post by krystol »

i havent used any of these easyuo resource gathering scripts yet. i was wondering if they could predetermine the type of resource that can be gathered from that tile?
Penny
Legendary Scribe
Posts: 210
Joined: Thu Oct 01, 2009 12:05 pm

Re: [EasyUO] Mining HUD

Post by Penny »

You mean that the script would remember what kind of metal you mined from the spot previously? If so, then yes.
Failure is not an option, it's a standard.
User avatar
Efanchenko_MM
Legendary Scribe
Posts: 213
Joined: Mon Aug 11, 2008 4:13 pm
Location: Essex, England

Re: [EasyUO] Mining HUD

Post by Efanchenko_MM »

I am having problems, I press play > adjust the red circle to my feet > press setup > all goes green > click scan > see the green & blue dots > click the green nearest me, But nothing happens, I have tried different locations, click wipe doesn't do anything, either, then I have to start the script over again, Any ideas?
EFANCHENKO MM
Penny
Legendary Scribe
Posts: 210
Joined: Thu Oct 01, 2009 12:05 pm

Re: [EasyUO] Mining HUD 1.01

Post by Penny »

It was a very +Hina-ish typo :P fixored
Failure is not an option, it's a standard.
User avatar
Viola
Adept Scribe
Posts: 41
Joined: Thu Jul 09, 2009 12:48 am

Re: [EasyUO] Mining HUD

Post by Viola »

Efanchenko_MM wrote:I am having problems, I press play > adjust the red circle to my feet > press setup > all goes green > click scan > see the green & blue dots > click the green nearest me, But nothing happens, I have tried different locations, click wipe doesn't do anything, either, then I have to start the script over again, Any ideas?
I have been looking for a mining script, and I tried to follow the directions but I have the same problem. It's a diamond of green squares and spread out blue squares and nothing happens no matter what I click.
The power of cute compels you!
So sayeth the Bunneh . . .

Image
Locked