Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

A script improving the UI (Item moving, diablo belt, more!)


  • Please log in to reply
10 replies to this topic

#1

RiskyChris

Posted 06 October 2010 - 07:04 PM

(10/30 - Mediafire Link)
(10/16 - New rapidshare link until I find a permanent host. )
(10/12 edit: Make sure to read my latest post, there was a small error in some of the code that you may want to edit yourself.  I'm going to release a new version of this script this weekend with some better resolution support and bug fixes as well)

(I wasn't sure if this was really applicable to mapping & mods, so maybe if it was someone can move it for me  :Pig:)

The other day I wrote a script (it utilizes AutoHotKey) that adds a little more functionality to Minecraft's UI.  As I had recently built a giant mob trap and huge tree farm, I was starting to get annoyed at how hard it was managing all my items (hard is an astronomical understatement).  To get to the point this script adds this:

- Alt+Click to instantly move items to a chest or back.  This even means if you're building stone pickaxes en masse, alt+clicking on them will "make a stack" just like you would click on torches!

- Shift+Right click will completely drain a chest of items or move your inventory or hotbar to a chest.

- Pressing 1-9 in your menus will automatically assign the item to the hotbar.

- You can now click and drag items to move them around instead of needing to click twice!  If you move the item to a tile occupied by something else, they'll swap places.

- Automatically restock hotbar buttons with a simple button press.  It'll use the column of items above it for replenishment.  The script won't do this unless you command it to, because I 1) didn't want to take away user control at a time when potentially a creeper was chasing you, and 2) it'd be a little too much like a bot for my tastes.

- The numpad is mapped to your workbench, for quick drawing of recipies.  Furthermore, a button will automatically craft a maximum-size stack of whatever you're creating!  Save your fingers when turning logs to sticks!

Now, I originally created this for myself, so the code is a little haphazardly thrown together and may not accommodate everyone's systems.  Here's some limitations:

- There's not a lot of idiot-proofing of actions.  If you hit 3 while aiming your cursor at empty air by your inventory, you'll throw your item away.  Consider this a feature  :Notch:

- Moving items around automatically only moves them to open spaces.  This means that if you have a stack of 20 coal in a chest and you alt+click more coal in, they won't combine.  The script hasn't been written to detect items yet.  I started to do this, but it was such a pain getting all the little sprites in order and figuring out how to detect # of items, etc.  I figure this kind of simple functionality would come up in an update sometime and I wanted to save coding time for... playing with blocks.  This isn't terribly tough to implement however (just ~100 sprites...), and I'll probably write it in this weekend if need be.

- The script works on images, scanning the screen to find empty tiles.  It was written for default skin UIs only.  However, the detection is really simple, and a swapping of a few image files for your custom skins would probably work just fine.  If not, the script is exceedingly simple to modify for whatever bumps come up.  In fact, a custom skin written with this kind of script in mind would probably help streamline a lot of the code.

- Resolution  Ah, the biggest bugaboo of this entire affair.  The UI does some funny scaling as you resize your window.  This can end up causing some item tiles to be different sizes than others.  As you run the configuration process the first time using the script, it will holler at you a lot to keep resizing your window until it finds a set of UI gumps that are the proper sizes.

Honestly, you don't *need* AutoHotKey to get this to run.  AHK can make a stand-alone .exe to run the program.  This would be useful if you ran Minecraft on multiple PCs but didn't want to set up AHK on each.  I'm not providing that compiled .exe at the moment.  The script assumes you use e as your inventory button, so if you didn't want that you'd have to go swap the edit yourself.  Additionally, if you wanted to modify any of the other hotkeys used it's easier at the moment to do so inside the script file.

Even more importantly!  If I or other people update this script to add more functionality, having the program that reads those scripts would be nice.  I had to stop adding features because some friends wanted to use the code.

I tried testing this at a lot of resolutions, but I can't catch every bug.  This was tested in Windows 7, and my usual play resolution is 1216x632.  I have found that the script does not like a maximized window at 1920x1280.  I have not tested it at fullscreen, and it definitely won't work with the browser client (without a little modification anyway).

How Get?

1) Download & Install AutoHotKey
2) Download the Script @ Rapidshare
(2.5) Backup your save!)
3) Extract the .zip somewhere cozy, and double click minecraft_UI_ext.ahk to just dive in.

4)I recommend reading readme.txt first as well as some of the script!  Remember, if your inventory hotkey is not e you'll have to change it in the script (it's in there twice). If you want, this is how to configure it:

Empty inventories, chests, and hotbar may aid in the calibration but may not be needed.  Once the script runs, it'll prompt you to configure.  The first slider in the box should really be kept at default.  If you shorten it, it'll try to do batch moves faster.  The second will set how many items in your belt will be restocked when you press ~.  The script has some resolution requirements on your window, such as being even.  Additionally, as you open up gumps for the script to analyze, a tooltip might pop up giving you a warning.  If this happens, you need to wiggle your window's size a bit and restart the calibration.  This happens because sometimes the UI stretches and causes some tiles to be different from others.

You will open in order the following windows: Inventory, Large Chest, Workbench, Furnace, Small Chest.  Check the GUI to see the progress.  It'll automatically close and save your config.txt once you've opened the small chest.  You should be good to go now!  Give it a spin.

The code isn't perfect, but I'm releasing it anyway since I know it'll work for a lot of people, and maybe it'll inspire some more bulletproof work with crazier features.  It's an alpha for an alpha.  :D

Known bugs:
- The workbench gump isn't always accurately identified on large resolutions (> 1296x998).  This may mean that workbench-specific hotkeys won't work.  =(

Register or log in to remove.

#2

PythonJones

Posted 06 October 2010 - 08:12 PM

Why not create a self contained exe version with Script to Exe Converter? It will make it easier for everyone and it saves you from having to install autohotkey.

Edit: Then again you couldn't customize it that with an exe.
When I see five weirdos, dressed in togas, stabbing a man in the middle of the park in full view of a hundred people, I shoot the bastards, that's my policy!

#3

Fluiq
    Fluiq

    Forum/Wiki Sponsor

  • Curse Premium
  • 39 posts

Posted 06 October 2010 - 08:25 PM

I don't know cause I haven't read anything of this.
But couldn't you make an .exe and make it customizble with a .ini?
I have use AutoItV3 and AutoHotKey to make stuff before (so I know its possible)

#4

RiskyChris

Posted 06 October 2010 - 08:29 PM

PythonJones said:

Why not create a self contained exe version with Script to Exe Converter? It will make it easier for everyone and it saves you from having to install autohotkey.

Edit: Then again you couldn't customize it that with an exe.

This is really what concerns me, especially since the script needs a little tweaking to better work with all resolutions.  I may post an .exe sometime later, though, if enough people want it.  The script will automatically configure itself to work without the user even needing to so much as look at the script, but if you wanted to change the key that it uses for your inventory, at the moment you'd need to go into the .ahk file.

Fluiq said:

I don't know cause I haven't read anything of this.
But couldn't you make an .exe and make it customizble with a .ini?
I have use AutoItV3 and AutoHotKey to make stuff before (so I know its possible)

Oh I'm sure.  I basically had to relearn the AHK over again since it's been years since I used it, so I was having troubles with customizable keys.  The script already uses an external configuration file to save your settings, so it's not like much needs to be touched in the script.

For anyone keeping score at home, the command to open the inventory in the script is written as send e.  I'll look at what to do to fix that and then a self-contained .exe is pretty possible.

#5

llama
    llama

    Out of the Water

  • Members
  • 2 posts

Posted 10 October 2010 - 11:15 PM

im running windows vista and when i open the script i cannot actually see it... the window for configuring the script comes up off the screen and i cant retrieve it. i can however see whats going on in the tiny little preview window on the task-bar lol. its kind of frustrating but i will figure out how to fix this if i can and post a fix. :Red:


EDIT: :Glass:  :o  :Red: i fixed it!!! it was ridiculous, i went to my old desktop and plugged in my old CRT monitor so i could dual screen and i found the config window on the other screen lol. so if anyone else has this problem this is how to fix it.

#6

llama
    llama

    Out of the Water

  • Members
  • 2 posts

Posted 11 October 2010 - 12:01 AM

:SSSS:  :SSSS:  :SSSS:  :SSSS:  :SSSS:  :SSSS:  :SSSS:  NOOOOO!!!!! the script  unintentionally gets rid of the ability to hold shift while moving and laying down blocks... for now im going to just delete the part of the script that messes with the shift button cuz i dont need to have the functionality of full inventory dumps but eventually id like to figure out how this code works so i can fix the problem without removing functionality...

:o  :SSSS:  :SSSS:  :SSSS:  other than that problem, i absolutely love this script!!! its wonderful!

#7

RiskyChris

Posted 12 October 2010 - 01:41 PM

llama said:

:VV:  :VV:  :VV:  :VV:  :VV:  :VV:  :VV:  NOOOOO!!!!! the script  unintentionally gets rid of the ability to hold shift while moving and laying down blocks... for now im going to just delete the part of the script that messes with the shift button cuz i dont need to have the functionality of full inventory dumps but eventually id like to figure out how this code works so i can fix the problem without removing functionality...

:P  :Diamond:  :Diamond:  :Diamond:  other than that problem, i absolutely love this script!!! its wonderful!

Yeah, along with what you posted above, those were two teeny little bugs in the script.  To fix the window appearing offscreen, you just need to modify a line near the bottom in the createGUI subroutine.  Look for a line that looks like this and replace the x1300 with x500.  It was opening at x-coordinate 1300, which on some screens may be too far.

Gui, Show, x500 w385 h235, Calibration - Minecraft UI Extension by RiskyChris

The inability to hold a key while pressing shift was really annoying, and here's a pastebin of the code you should replace your shift and shift+Rbutton code with:

http://pastebin.com/gY3hW2ca

I have made some changes to the script that lets it work on all resolutions, but I need to finish a bit of it.  I'll probably setup a github for the project and upload the new version this weekend.

#8

bloodknight2000

Posted 18 October 2010 - 04:01 AM

well i have installed autohotkey and I have tried using both versions of this script, both just get to the calibration window and then it will not update. as far as i can tell nothing happens. i have tried running auto hotkey as admin and in compatability mode, and i have tried resizing the screen... nothing works is there anything that i have not tried yet?

#9

PointZeroOne

Posted 18 October 2010 - 04:07 AM

You can make an autohotkey create an exe for the script, but yeah you can't customise it once you've done that.

#10

johnsharktire

Posted 11 November 2010 - 02:59 AM

does this still work?  the rapidshare link is down.

#11

roadrunner96

Posted 27 November 2010 - 02:44 PM

this, is awsome, thanks for sharing..., hope you keep developing it
Posted Image