Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Achieve GDI+ based game-like achievements function


  • Please log in to reply
2 replies to this topic
JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
So I wrote an achievement generator and callable function for a project I'm working on. I thought I'd share it here because it's fun and pointless :D

DOWNLOAD

How it works:
This function draws an achievement frame from scratch using the GDI+ standard lib (required)
When called in a script, it draws the frames, renders the achievement text to an image, and saves it to a file if specified.

What it can do:
This is mostly pointless, but can add a nice touch to a finished app.
It plays a ding sound when called (included in zip)
It supports both the progress style and static style achievements.
Support for url based images for the icon/trophy

Current limitations:
The function is modal, meaning if you chain the function quickly, the app will wait until they all finish. (I recommend calling with a timer or the like to avoid WTF moments)
Function is _L dependant (named gui to avoid code bleeds(NOTE: this can be changed to a numbered gui for basic compatability))

The function parameters:
ACHIEVE(ACH_NAME,ACH_TEXT,ACH_ICON,PNG="",USE_PROG="",START="",END="")
USAGE: Call this with ACH_NAME (text), ACH_TEXT (text), and ACH_ICON (image path/url) to generate an achievement popup

PARAMETERS:
ACH_NAME - Name text, first line
ACH_TEXT - Body text, second line
ACH_ICON - Icon image, trans background works best
PNG - Location to save rendered image to, png recomended (optional)
USE_PROG - Create progress style achievement frame, evaluated as BOOL 0/1 - blank/non-blank (optional,START and END required when used)
START - Current value of progress bar (optional, USE_PROG dependant)
END - Max value of progress bar (optional, USE_PROG dependant)


Screenshots:
Posted ImagePosted Image
Posted ImagePosted Image
Posted ImagePosted Image

Helper tool:
Posted Image
The "ACHIEVE_TEST_GIU_.ahk" included in the zip can help fine tune achievements before you implement them, or if you are like me, use it to insult your co-workers in a creative fashion.
Some notes on the tool:
Achievement icon can be a url (the image is downloaded to "temp.png")
Next to the progress checkbox, the completed function call is generated for easy paste into your script
Achievement bmp path is where the output file is saved, and the name of it

Technical notes:
Platforms tested: XP 32SP3, W7ult64, W8preview

Last note:
Feel free to use/modify/abuse these scripts however you see fit. As always criticism/commenting is welcome and encouraged. Also Zizorz pairs great with this ;)

Thanks to tic (Tariq Porter) for his GDI+ Library
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

sumon
  • Moderators
  • 1317 posts
  • Last active: Dec 05 2016 10:14 PM
  • Joined: 18 May 2010
Wow, this is not only hilarious, but potentially useful too (in many ways similar to Notify()). Gonna experiment with it for sure :) GDI+ ftw, I like this.

PS. +1 for the Zizorz plug. With that, I assume you mean that it's a nice way to screenshot fast for those hilarious moments? I must note that Zizorz win-capture mode doesn't seem to work quite perfectly.

JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
I only found notify() after I had finished writing this function, but yes they are much the same. I mentioned Zizorz because it makes it very easy to capture a square-ish area of the screen and upload to url. That works perfectly with the test gui for generating on-the-fly achievements to troll co-workers with.
Such as:
Posted Image
I send them <!-- m -->http://i.imgur.com/ALJ1Z.jpg<!-- m --> ;)

I wrote this for an app I have long maintained at work that call center reps use to take notes while troubleshooting. In addition it can track other stats, which ultimately led to a joke (the way most of my more elaborate scripts start out) about getting achievements for sucking at your job. One day while playing with radial menus and by association GDI+ I wrote this and implemented it into my app. Along with it, I added an 'Achievement points' system so reps had a 'score' as well as a folder with the output png files called the trophy room. In the way I implemented it, users get achievements for entering secret character names into the user's name field (ie James Bond) or going long amounts of time and not taking any calls, exceeding a number of characters in the notes fields, opening the app X number of times etc. It's all a big joke, but my user base has been very receptive of the addition and the humor.

Such as:
Imagine you work in a call center. You answer a call and it immediately disconnects and you get an achievement window pop up:
Posted Image
And boom, I just made your day ;)
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn