Sunday, April 5, 2009

Another Darkfall Macro for AutoIT - The Darkfall Quickloot macro

This is a simple quick-loot AutoIT macro for Darkfall, that can help speed up your looting. With all the competitive looting going on, this might give you an edge.

(You might also be interested in the AutoClicker Macro)

You will need AutoIT to run this script, you can download it from here: http://www.autoitscript.com/autoit3/

After you have installed AutoIT, copy the script below into a text editor and save it as "quickloot.au3". If you chose to bind au3 files to AutoIT when you installed it, you can then just doubleclick this file to start the macro.

Instructions

You will need to set the position of your bag (you should always keep your bag open). This is done with the CTRL+F5-F8 keys.

CTRL+F5: Increase X position
CTRL+F6: Decrease X position
CTRL+F7: Increase Y position
CTRL+F8: Decrease Y position

To find the ideal position just start Darkfall, exit mouselook mode and press CTRL+G. Look for where the mouse ends up. You don't have to have a loot window open for this. Then adjust until you see the mouse end up inside your bag.

You should try to aim for the center of your bag. The script adds some randomnes to where it puts the items in the bag, so everything doesn't end on top of each other.

If you are playing in windowed-mode (recommended) you will see a pop-up from the script in your systray telling you the current X and Y positions it is using for your bag.

When you have found your ideal position, you can change the script so you don't have to click around every time. The lines to change are:

Global $x = 1500
Global $y = 950

The next time you come over some phat l00t, all you have to do is mouse over the item you want to loot and press CTRL+G. The macro will then drag the item to your bag.

And here is what you came for - the script:

;
; Darkfall QuickLooter script for AutoIT
; 
; The script below is released into the public domain
; by me, the author 
;
; http://lostontheintarweb.blogspot.com/
;
; AutoIT can be found at http://www.autoitscript.com/autoit3/
;

; Position of the bag
; Change to reflect the position of YOUR bag
Global $x = 1500
Global $y = 950


; Bind to CTRL+G
HotKeySet("^{g}", "Loot")

; CTRL+F5-F8 changes bag position
HotKeySet("^{F5}", "DecreaseX")
HotKeySet("^{F7}", "DecreaseY")
HotKeySet("^{F6}", "IncreaseX")
HotKeySet("^{F8}", "IncreaseY")

; --- User configurable variables end here ---
; --- Do not edit below unless you know what you are doing ---
Global $fade = False
Global $fadetime

; Displays tray bubble
Func Bubble($text)
 TrayTip("Darkfall AutoClicker", $text, 5)
 $fade = True
 $fadetime = TimerInit()
EndFunc

Func IncreaseX()
 If $x < 5000 Then
  $x = $x + 50;
 EndIf
 Bubble(StringFormat("Bag position: x = %d, y = %d", $x, $y))
EndFunc

Func IncreaseY()
 If $y < 5000 Then
  $y = $y + 50;
 EndIf
 Bubble(StringFormat("Bag position: x = %d, y = %d", $x, $y))
EndFunc

Func DecreaseX()
 $x = $x - 50;
 If $x < 0 Then
  $x = 0
 EndIf
 Bubble(StringFormat("Bag position: x = %d, y = %d", $x, $y))
EndFunc

Func DecreaseY()
 $y = $y - 50;
 If $y < 0 Then
  $y = 0
 EndIf
 Bubble(StringFormat("Bag position: x = %d, y = %d", $x, $y))
EndFunc


; Does the quick-loot
Func Loot()
 $x1 = MouseGetPos(0)
 $y1 = MouseGetPos(1)
 $x2 = $x + Random(0, 75)
 $y2 = $y + Random(0, 75)
 MouseClickDrag("left", $x1, $y1, $x2, $y2, 1)
 MouseMove($x1, $y1, 1)
EndFunc

; --- Start of main routine ---
TraySetIcon("explorer.exe",110)
Bubble("Darkfall QuickLoot Started")
WinActivate ( "Darkfall Online" ) 

While 1
 ; Fade out bubble now?
 If $fade Then
  If TimerDiff($fadetime) > 1000 Then
   $fade = False
   Bubble("")
  EndIf
 EndIf 
 Sleep(25)
WEnd

Saturday, March 14, 2009

Darkfall autoclicker script for AutoIT - macro that auto clicks for you

Darkfall is a recently released MMO game. As in many other MMOs gathering and crafting mostly consists of pressing the same button over and over at the same spot.

This can be a bit tedious to say the least, but the Darkfall team recently stated in a post on their forums here that it's OK to use macros, as long as you don't go AFK.

An autoclicking macro will help you with both gathering and crafting in Darkfall, by clicking for you at regular intervals.

So I guess a lot of folks are asking right now, how does this work? Well I'll give you my solution.

We'll be using a program called AutoIT. This program sends key/mouse presses to Darkfall. It does not modify the game in any way.

First you need to download and install AutoIT from here: http://www.autoitscript.com/autoit3/

After you have installed AutoIT, create a new text file somewhere on your computer. Name this file something like DarkfallAutoClicker.au3 (the .au3 is important).

In this file you put the script below. After you have saved it, you should be able to just double-click it to start.

How to use
F1: Run / Pause
F3: Shorter delay
F4: Longer delay
F5-F8: Speed 1/2/3/4

The default speeds for F5-F8 can be set in the script (in milliseconds) and the hotkeys can be changed aswell.

Should be pretty straightforward.. Here is the script:

; ----------------------------------------------------
;
; Darkfall AutoClicker script for AutoIT
; 
; The script below is released into the public domain
; by me, the author 
;
; http://lostontheintarweb.blogspot.com/
;
; AutoIT can be found at http://www.autoitscript.com/autoit3/
;


; --- Configurable constants ---

; Default speeds for F4-F8
Const $speed_1 = 5200
Const $speed_2 = 10200
Const $speed_3 = 15200
Const $speed_4 = 21200

; Minimum and maximum speed
; To avoid nasty stuff like negative speed
Const $min_speed = 1000
Const $max_speed = 120000

; F3-F4 will vary the speed with this amount
Const $speed_step = 1000

; Fade time for tray-bubble
Const $bubble_fade_time = 1000

; --- Hotkey Definition ---
; + is SHIFT ^ for CTRL and ! for ALT
; Read more here: http://www.autoitscript.com/autoit3/docs/functions/Send.htm
HotKeySet("+{F1}", "Toggle")

HotKeySet("+{F3}", "SpeedDown")
HotKeySet("+{F4}", "SpeedUp")

HotKeySet("+{F5}", "Speed1")
HotKeySet("+{F6}", "Speed2")
HotKeySet("+{F7}", "Speed3")
HotKeySet("+{F8}", "Speed4")

; --- User configurable variables end here ---
; --- Do not edit below unless you know what you are doing ---


Global $run = False   ; Runs while true
Global $speed = $speed_1 ; Default is speed_1
Global $fade = False  ; After bubble
Global $fadetime   ; Time bubble starts
Global $click = False  ; Click-in-progress
Global $clicktime   ; Time of last click


; Displays tray bubble
Func Bubble($text)
 TrayTip("Darkfall AutoClicker", $text, 5)
 $fade = True
 $fadetime = TimerInit()
EndFunc

; Increase speed
Func SpeedUp()
 $speed = $speed + $speed_step
 If $speed > $max_speed Then
  $speed = $max_speed
 EndIf
 Bubble(StringFormat("Speed set to: %d", $speed))
EndFunc

; Decrease speed
Func SpeedDown()
 $speed = $speed - $speed_step
 If $speed < $min_speed Then
  $speed = $min_speed
 EndIf
 Bubble(StringFormat("Speed set to: %d", $speed))
EndFunc

; Set speed 1
Func Speed1()
 $speed = $speed_1
 Bubble(StringFormat("Speed set to: %d", $speed))
EndFunc

; Set speed 2
Func Speed2()
 $speed = $speed_2
 Bubble(StringFormat("Speed set to: %d", $speed))
EndFunc

; Set speed 3
Func Speed3()
 $speed = $speed_3
 Bubble(StringFormat("Speed set to: %d", $speed))
EndFunc

; Set speed 4
Func Speed4()
 $speed = $speed_4
 Bubble(StringFormat("Speed set to: %d", $speed))
EndFunc

; Toggle run/pause
Func Toggle()
 $run = NOT $run
 If $run Then
  Bubble(StringFormat("Running at speed: %d", $speed))
  TraySetIcon("explorer.exe",110)
 Else
  Bubble("Paused")
  TraySetIcon("explorer.exe",111)
 EndIf
EndFunc

; --- Function definitions end here ---
; --- Start of main routine ---
TraySetIcon("explorer.exe",111)
Bubble("Darkfall AutoClicker started")
WinActivate ( "Darkfall Online" ) 

While 1
 ; Fade out bubble now?
 If $fade Then
  If TimerDiff($fadetime) > 1000 Then
   $fade = False
   Bubble("")
  EndIf
 EndIf
 
 ; Run mode?
 If $run Then
  If Not $click Then  ; First click
   WinWaitActive("Darkfall Online")
   MouseClick("left")
   $click = True
   $clicktime = TimerInit()
  Else
   ; Delay has passed, time for new click
   If TimerDiff($clicktime) > $speed Then
    $click = False
   EndIf
  EndIf
 EndIf

 Sleep(50) ; IMPORTANT! Don't eat too much CPU
WEnd
; ----------------------------------------------------

Saturday, March 15, 2008

Running the twisted deamon (twistd) on Windows

Twisted is a networking library for python, which I find really good. I've only just started playing with it, and ran into some problems when trying to get it to run as a daemon under windows (using twistd - the twisted daemonizer). The information about this on the web seemed scarce, so I decided to post my findings.

When you install twisted, it comes with a special command-shell. But after looking at it, I found that it wasn't all that special afterall. It's just a batch-script that sets up a regular shell for you, all ready to start twistd.

As I do my programming in Eclipse, I wanted to start the server directly from inside the IDE. The way I did this, was by adding a .bat file to my project. The contents of the .bat file needs to be something like this:

set PATH=%PATH%;c:\python25;c:\python25\scripts
set PATHEXT=%PATHEXT%;.py;.pyc;.pyw;.pyo
set PYTHONPATH=%PYTHONPATH%;c:\your_source_dir
cd c:\your_source_dir
twistd -noy your_server_daemon.tac
pause

You have to change three things here, the two your_source_dir and your_server_daemon.tac and also the python directory.

The first line adds the python executable to your path. In my case this is c:\python25 - you will need to change this depending on your python install. It also adds the scripts directory where your twistd.py should reside.

Next we set the PATHEXT variable, this lets you run .py files (and .pyc and so on) directly from the command line without invoking the python interpreter manually (the way it works on *nix).

After that, we add the directory (or directories) where our source files reside to the PYTHONPATH. Without this, you will get an "ImportError: No module named blabla", or "Failed to load application: No module named blabla" for all your imports. (You can also add to the pythonpath from inside your program, but I find that it's a bit cleaner this way).

Next we change into our source directory, simple as that.

After that, it's simply a matter of starting the twisted daemon (twistd) with our configuration (.tac) file. -noy means that we start the specified .tac and log to stdout (look up twistd in the twisted docs for more info). To stop the server, simply press Ctrl+C.

The pause at the end is only there so that the window doesn't close immediately after the program ends, but waits for a keypress.

More on twisted here:

Wednesday, March 5, 2008

Get rid of the system 'BEEP' sound in VMWare

If you use VMWare, you might, like me, have had a hard time finding out how to disable the system beep sound.

Turns out you have to edit the .vmx file yourself, and include the following line:

mks.noBeep = TRUE

That should shut up the annoying mother.....BEEP

Sunday, February 24, 2008

Free alternative to Flash / ActionScript

Flash is a technology developed by Adobe, which is quite popular for creating dynamic content for web pages. It lets you make animations, games and interactive applications.

To make these apps, most people use Adobes own development environment. However, their newest Flash Professional CS3 sets you back almost $700.

If you don't have that kind of money (or you are a cheapskate) you can still create Flash apps using the free haXe language. haXe is an open-source compiler, that lets you compile to not only Flash, but also Javascript and Neko thus letting you create both the client-side and the server-side of Ajax applications!

Sound interesting? Well it is! I'll point you in the direction of haXe:

You might also want a good editor to go with that. You can for example use FlashDevelop, which is free and open-source:

Saturday, February 23, 2008

Choosing a Python development environment

If you are going to be doing any kind of serious development, you will most likely want an integrated development environment (an IDE). This will help you organize your projects and source files, and give you additional tools like automatic code completion and syntax highlighting.

Many people get by using just their favourite text-editor, be it a simple one like notepad, or more complex editors like Emacs or UltraEdit. And there is nothing wrong with that, I guess - but me I prefer to use a tool where everything is integrated.

For Python development, there are quite a few free alternatives. Idle is one of them, and comes bundled with Python when you download it. It's a no-fuzz editor and shell, and is great for those who like simplicity. It's fast and does everything you really need.

If you want to step up a bit, there is Pype, or Python Programmers' Editor which is an editor targeted specifically at Python development. It has lots of nice features which helps you speed up development.

None of these are what I would call a real IDE though. For that, look to Eclipse. This is my favourite IDE for any programming language, not only Python. It was originally intended for Java, and is written in Java, and so can be a bit more than you need and also might be a bit sluggish at times. It does however have all the features you will ever need, and more.

Eclipse is fully modular, meaning that you can add support for different languages as you go along. Java, C / C++, Python, Perl, PHP - whatever you throw at it, you can be almost certain that there is a module for Eclipse that supports your language.

Also Eclipse is free and open-source, which is one of the reasons I like it so much.

There are of course also quite a few commercial IDE's for Python. I haven't tried any of them, but some of them (like the Wing IDE) look quite good. You might want to look for some evaluation versions, if you want to fork out some cash for a professional solution (though Eclipse is VERY professional).

Check out the links:

3D Programming

Are you thinking about writing the next Crysis? Well, you most likely won't. At least not by yourself. But if you want to write smaller games or virtual worlds in 3D, there are some good quality free libraries that you can use.

For me, this boils down to a battle between a cuddly pandabear and a trollish ogre, represented by two excellent free libraries called Panda3D and Ogre3D.

Panda3D is a library written by Disney, and maintained by Carnegie Mellon University's Entertainment Technology Center - while Ogre3D is a true open source project.

For simple usage, they are almost equal - but in my opinion Panda is easier to use while Ogre has the most features and cutting edge technology.

While both are written and optimized in C / C++, Panda is intended for programming in Python. If you are a Python user this is a good thing, as everything is very "pythonic". You can also get Python bindings for Ogre, but since this is more of an afterthought you can clearly see it's legacy from C++.

Why would I program a 3D application in Python anyway, you might ask. Isn't that really slow? Well, not really. Since all the 3D functions are already programmed in C / C++ there is no real slowdown in the rendering process. Your Python code is only "glue". And with Python, you get a lot more done in less time - so it makes sense if you are programming on your own or in a small team.

So in the battle of Panda vs. Ogre, who will win? If you are a C / C++ programmer, the choice is clear - Ogre is the most suited for you. If you, like me, like Python, the answer is more "it depends". I would go for Ogre because of it's more advanced features, but you might like the Panda better because it is very pythonic and a little simpler to use.

Check them out yourself here:

There is also Irrlicht, which is an impressive one-man effort. It also has a Python wrapper called Pyrr. It's real easy to start using, all you need is right there. However, it is somewhat lacking in features compared to Ogre and Panda, and seems to be geared at writing FPS games. You can check it out here:

Friday, February 22, 2008

Linux search and replace in files

So you want to replace a regular expression in multiple files under Linux?

Well, there are two convenient ways this can be done with a single line from a shell.

First, you can use SED

sed -i -e 's/source/destination/g' *.txt

"source" is of course the part to search for, and "destination" is what you want it replaced to. Also replace *.txt with whatever.

The second solution is to use perl

perl -pi -e 's/source/destination/g' *.txt

If you want something really nasty, you can use perl mixed with the 'find' command

perl -pi -e 's/source/destination/g' `find . -name '*.txt'`

Note the different quotes here... Might be a bit tricky to find, depending on your keyboard layout. This lets you replace in the files found by the find command, and is a quite powerful form of search and replace.

Thinking about learning a programming language?

Have you ever had an idea for a dream application, but never knew how to program it?

A lot of people starting to program use Java or C / C++. Java is considered to be easy, because it handles things like garbage collection for you, and there is no such thing as pointers - which is something that confuses new programmers a lot in C / C++.

Most end up using C / C++ because it is the "industry standard" - but this does not automagically mean that this is the best language. If you are thinking about learning to program, I suggest you check out the Python language.

Python is a "scripting language", but is extremely powerful. It can be used with ease for programming web-pages for example in the place of PHP or Perl, but also for full blown applications with a nice user interface and all the bells and whistles.

The saying among Python programmers is that it makes you 10 times more productive than if you were programming in C++, because you have to write a lot less code. This is an important point if you are programming by yourself or in a small team, because your program is ready for market in a much shorter time - and you also have a lot less code to maintain.

By using wxWidgets for Python, you can have a multi-platform (Linux / Windows / Mac) application with a GUI ready in a few hours, if not minutes.

Python really lets you do a lot of things that C / C++ doesn't, because the philosophy is that you, the programmer, should be in charge - and decide for yourself the best way to accomplish a solution to your problem.

I recommend you check it out if you are interested in programming:

If you want a graphical GUI builder, check out wxGlade, which can generate wxWidgets source code for Python and C++

Delete all emacs backup-files under linux

Do you ever use emacs on linux? In that case you most certainly have noticed that it creates backup files for you (filenames ending in ~).

Backups are great, but sometimes you don't want them cluttering your directories. What if you could remove them with a single command line? Well you can. The following line will remove all files ending in ~ from your current directory and all subdirectories.

$ find ./ -name '*~' -exec rm '{}' \; -print -or -name ".*~" -exec rm {} \; -print

More here: AnyExample.com