InGame v2.0

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: InGame v2.0

Socket

Post by _3D_ » 16 Jul 2018, 12:23

[Function] SocketMove
Move data to given socket (like CommMove) fully compatible with Virtual Serial Ports Emulator (VSPE) http://www.eterlogic.com/Products.VSPE.html

Code: [Select all] [Expand]GeSHi © Codebox Plus

Functions FileMove, CommMove and SockMove covered 90% of possibilities for data transferring to kitchen printers.
The whole project can work as data "transmitter", data "router" and data "server".

[Function] Tip

Post by _3D_ » 28 Jun 2018, 08:30

One more crazy syntax using associative array.

Code: [Select all]GeSHi © Codebox Plus

Tip(text:= "", what:= "") {
tray(t) => traytip(t,,0x10) ;different arguments list
;tooltip(t)

;if key not exist list will return ""
static tarr:= {"tray":"tray", "tool":"tooltip"}
static ttip:= tarr["tray"]

;if "" use last known
%(ttip:= tarr[what]? tarr[what]: ttip)%(text)
}
No try, no catch, just one ternary.
Enjoy!

Universal Communications

Post by _3D_ » 26 Apr 2018, 12:30

[Function] writesize
It is a simple function that calculate offset and size of buffer that we can send trough comm port or socket port.

Code: [Select all]GeSHi © Codebox Plus

writesize(offs, buff, size) {
if offs < size && (res:= size - offs) >= buff
res:= buff? buff: res
return res
}
Yes it is just one IF.

[Function] CommMove
Write given file (buffer) to given comm port.

Code: [Select all] [Expand]GeSHi © Codebox Plus


Enjoy!

Universal Communications

Post by _3D_ » 04 Mar 2018, 03:06

[FUNCTION] encoding().
AHK have brilliant system for changing encoding, unfortunately Bulgarian DOS code page never supported by Microsoft https://en.wikipedia.org/wiki/MIK_(character_set) and Bulgarian WIN code page is CP1251.
Function convert data buffer from to CP1251 and CPMIK (no standard number, in some documentations CP856).

Code: [Select all]GeSHi © Codebox Plus

encoding(byRef addr, size, enco) {
if enco:= inStr(enco, "WIN")? +64: inStr(enco, "DOS")? -64: 0 {
loop size
if (char:= numGet(addr, A_Index-1, "UChar")) >= 0x80
numPut(char + enco, addr, A_Index-1, "UChar")
} }
Usage:

Code: [Select all]GeSHi © Codebox Plus

file:= "c:\path\file.txt"
data:= FileRead(file, "RAW")
size:= FileGetSize(file)
encoding(data, size, "WIN") ;convert CPMIK to CP1251
encoding(data, size, "DOS") ;convert CP1251 to CPMIK
As I use object to put data into:

Code: [Select all]GeSHi © Codebox Plus

encoding(byRef port, enco) {
if enco:= inStr(enco, "WIN")? +64: inStr(enco, "DOS")? -64: 0 {
addr:= port.getAddress("data") ;Helgef
loop port.size
if (char:= numGet(addr, A_Index-1, "UChar")) >= 0x80
numPut(char + enco, addr, A_Index-1, "UChar")
} }

Enjoy!

Universal Communications

Post by _3D_ » 01 Mar 2018, 08:45

This days I completely down the games and work on communicate to kitchen printers wire and wireless (esp8266).
There is a working set - but still in test mode. So I first will post some functions then complete project.
[FUNCTION] Tip - it is a simple function that combine toolTip and trayTip together.
Classic mode:

Code: [Select all]GeSHi © Codebox Plus

Tip(text:= "", what:= "tray") {
if inStr(what, "tray") {
traytip(text,,0x10)
return
}
if inStr(what, "tool") {
tooltip(text)
return
} }
Switch mode:

Code: [Select all]GeSHi © Codebox Plus

Tip(text:= "", what:= "tray") {
try {
goto(what)
tray:
traytip(text,,0x10)
return
tool:
tooltip(text)
return
} }
And Usage:

Code: [Select all]GeSHi © Codebox Plus

Tip("Tray tip to test")
sleep(1000)
Tip()
Tip("Done the tray up the tool", "tool")
sleep(1000)
Enjoy!

Xerox Counters [Out of InGame v2.0]

Post by _3D_ » 13 Jan 2018, 07:32

This is a small out of course InGame project.
The idea is to get counters for given Xerox machines with web interface.

Code: [Select all] [Expand]GeSHi © Codebox Plus

It is needed INI file with name AHKscript.ahk.ini
Next is example ini file

Code: [Select all]GeSHi © Codebox Plus

wc232.xcc.cs | http://wc232.xcc.cs/properties/billing/billingCounters.dhtml
gAllMarkedImages
gBlackCopyImages
gBlackCopySheets

m55.xcc.cs | http://m55.xcc.cs/properties/billingCounters.dhtml
markedBWandColorImages
markedBWCopyImages
markedBWPrintImages
Output:

Code: [Select all]GeSHi © Codebox Plus

wc232.xcc.cs,269606,173481,139125
m55.xcc.cs,1845940,1343841,501892
Syntax:

Code: [Select all]GeSHi © Codebox Plus

machine | machine/web/page/that_contain/counters
counterName
Limitations:
• counterName can be right before counterDigits (mean no any other digits between).
• missed download links take about 30 seconds each till ErrorLevel be set.
It is Saturday small project - but very useful for copy centers with Xerox machines.
Enjoy!

class Task (Task.List:= [])

Post by _3D_ » 04 Jan 2018, 06:16

As I see that no ALL task forced closed
https://lexikos.github.io/v2/docs/commands/For.htm
Existing key-value pairs may be modified during the loop, but inserting or removing keys may cause some items to be skipped or enumerated multiple times. One workaround is to build a list of keys to remove, then use a second loop to remove the keys after the first loop completes.
I start investigate why and result:
https://autohotkey.com/boards/viewtopic.php?p=192392#p192392
https://autohotkey.com/boards/viewtopic.php?p=192750#p192750
Revised class Task
:

Code: [Select all] [Expand]GeSHi © Codebox Plus

It is completely compatible with early version.
Last edit 11.Jan.2018

IniReadPixel() and ColorIs()

Post by _3D_ » 07 Nov 2017, 08:34

I made and revision of IniReadPixel() and little revision of ColorIs()

Code: [Select all] [Expand]GeSHi © Codebox Plus

This is working example that will wait 10 seconds to become pixel(645:354) 0xFFFFF1 or 0xC9CED4 and will return result and pixel object.
[Edit] I add try catch return"" if pix argument is not Object.
Enjoy!

[FUNCTION] ColorIs() - revized

Post by _3D_ » 30 Oct 2017, 08:41

In https://autohotkey.com/boards/viewtopic.php?f=19&t=2400&start=40#p112863
I describe function that check for given colors and do defined for that colors actions. Now without for.

Code: [Select all]GeSHi © Codebox Plus

ColorIs(sec, byRef pix:="", mis:= 998) {
loop sec {
tooltip(sec--) ;
if dd_varExist(pix[pix.c:= PixelGetColor(pix.x, pix.y)]) ;add c to pix
return pix[pix.c]
sleep(mis)
}
return "" ;return "" instead of 0
}
Now function check if is there "key" that is equal to current color and if true return defined value.

Code: [Select all]GeSHi © Codebox Plus

dd_varExist(ByRef v) { ;check if v exist
return !(&v == &_)
} ;==========
Enjoy!
[Edit] And revision without external functions:

Code: [Select all]GeSHi © Codebox Plus

ColorIs(sec, byRef pix:="", txt:= "", mis:= 998) {
loop sec {
tooltip(txt sec--)
if pix[pix.c:= PixelGetColor(pix.x, pix.y)] != "" ;add c to pix
return pix[pix.c]
sleep(mis)
}
return ""
}
In this case when value is "" then variable don`t exist. (I prefer to check if variable exist).

Helgef

Post by _3D_ » 19 Oct 2017, 03:12

Thanks Helgef for the great idea.
Cheers. :beer:

Re: InGame v2.0

Post by Helgef » 18 Oct 2017, 12:24

You have some interesting stuff here. I only
browsed the first page for now. The switch is nifty . I think you need a table of contents though ;)
Thanks for sharing, cheers :thumbup:

[FUNCTION] contain(this, needle)

Post by _3D_ » 18 Oct 2017, 08:48

FIRST try to create function that can return result if this contain needle.
First of all we need strong criterion what we need to find and how to represent it? In most cases we have VALUE and in some cases KEY:VALUE, but in both we have stronger division VALUE or KEY. So let say that this two things we need to search in complete order (mean KEY == NEDDLE or VAL == NEEDLE) and let say that we need sign where KEY/VAL begin and where KEY/VAL ended. If we know that we can convert any AHK type to string and in last to search with InStr().
I chose "|" for begin and "|" for end in this case:
KEY become |KEY|
VAL become |VAL|

Code: [Select all] [Expand]GeSHi © Codebox Plus

Code extremely small but check if this exactly contain needle. Due to same converting algorithm we have strong equal for the equal objects.
disadvantage - no difference what we found KEY or VAL but it exist into this.
disadvantage - [1:1, 2:2] is equal to [12:1, 23:2] - if key integer key not present in string.

Enjoy!

Timers inGame

Post by _3D_ » 17 Oct 2017, 03:45

There many things that player must check and use. It is example howto keep bufs and auto select nearest mob.

Code: [Select all] [Expand]GeSHi © Codebox Plus

CapsLock activate/deactivate killing state.
Numpad buttons activates bufs and reset timers - so player can forced bufs timer independently.

Enjoy!

DEREF back to AutoHotkey_2.0-a081-cad307c

Post by _3D_ » 01 Sep 2017, 00:19

AutoHotkey_2.0-a081-cad307c
Back deref to v2.0 - partial solution - next code replace variables with variables values.

Code: [Select all]GeSHi © Codebox Plus

__deref_Expression:= "" ; <<< expression string
__deref_LABEL: ; deref ---------------------------------- AutoHotkey_2.0-a081-cad307c
if RegExMatch(__deref_Expression, "i)[%][a-z_]\w*[%]", __deref_Variable) {
__deref_Expression:= RegExReplace(__deref_Expression
, "i)" __deref_Variable.Value
, %subStr(__deref_Variable.Value, 2, -1)% "")
goto __deref_LABEL
} ; ---------------------------------------------------------------------------------
This code work exactly as removed deref() function:
1. Code recognize only enclosed in %% names and replace with values ("%variable%")
2. Code must be stored at the place where variables must be deref. (Due to variable scope function impossible).
3. Code just replace variable names with there values - no EVALUATION.
4. Loop is implemented as LABEL \ goto LABEL to be visible A_Index and A_Loop... variables

EVALUATION by tidbit

Code: [Select all]GeSHi © Codebox Plus

dd_tidbitEval(expression) { ; 
obj:=ComObjCreate("HTMLfile") ;tidbit code -------------------------------------------
obj.write("<body><script>document.body.innerText=eval('" expression "');</script>") ;--
return obj.body.innerText
}
Functions not allowed (it is HTML evaluation). I can`t experiment with AutoHotkey.dll due to user defined functions limitation.
User can put functions values as variables in expression string and then evaluate.

Enjoy!

Gdip+ AutoHotkey_2.0-a081-cad307c

Post by _3D_ » 28 Aug 2017, 08:14

AutoHotkey_2.0-a081-cad307c
Correct syntax
    if expression, expression
    sysget
    sysget Monitor
    loop,
Attachments
Gdip-AHKv2.0-a081-cad307c.zip
(18.95 KiB) Downloaded 45 times

TypeOf(this)

Post by _3D_ » 27 Aug 2017, 07:27

AutoHotkey_2.0-a081-cad307c
Function TypeOf(this) edited ultra compact

Code: [Select all]GeSHi © Codebox Plus

typeOf(this) {
__type:= __name:= type(this)
if isObject(this) {
__type:= "Object"
try if this.__Class && __name != (__type := "Class")
throw
catch
return __type "|" __name
}
return __type
}
Examples: https://autohotkey.com/boards/viewtopic.php?p=167373#p167373

NumpadDot-To-Dot

Post by _3D_ » 21 Jun 2017, 09:57

When multilingual keyboards in many cases need to remap NumpadDot to Dot.
For Example In Bulgarian keyboard layout NumpadDot is coded like , (coma) - it is STANDARD but all need . (dot) there.

There many programs that remap keys like KeyTweak and Sharp Keys but all works perfect only in US keyboard layout (and last Windows 10 ignored in other layouts).

Problems:
1. When totally remap NumpadDot (scan code) - we lose DEL functionality.
2. When remap NumpaDot to Dot - worked only in US layout.

Example that I find in internet

Code: [Select all]GeSHi © Codebox Plus

NumpadDel::Send .
represent problem 1 and 2.
In first I modify to

Code: [Select all]GeSHi © Codebox Plus

NumpadDot::Send .
that work perfect and with last Windows 10.

Of course there short code

Code: [Select all]GeSHi © Codebox Plus

NumpadDot::.
It remap button only when NUMPAD is active and work in nonUS keyboard layouts.
Tested on US, Bulgarian - BDS and Bulgarian - Phonetic.

Make NumpadDot-To-Dot.ahk

Code: [Select all]GeSHi © Codebox Plus

#SingleInstance, Force
;Copyright (c) D.Donchev

NumpadDot::.

Rename copy of AutohotkeyU64.exe (for 64Bit OS) or AutohotkeyU32.exe (for 32bit OS) to NumpadDot-To-Dot.exe
Put this 2 files together in some place and set Windows to start NumpadDot-To-Dot.exe at the begining.

So AHK the best choice ever!
Enjoy!

dd_ToolTip

Post by _3D_ » 28 May 2017, 17:09

Function dd_ToolTip - revised

Code: [Select all] [Expand]GeSHi © Codebox Plus

Function dd_ToolTip is usable when in one place you set message and in other place you need to add extra text to message. In example sleep and count.

Enjoy!

RegExNMatch

Post by _3D_ » 25 May 2017, 08:17

RegExNMatch - revised.

Code: [Select all] [Expand]GeSHi © Codebox Plus

Changes:
1. while Numbers-- instead of loop Numbers - negative value produced loop until break.
2. check if v.count() - stop iterations if pattern match nothing (void looping).

Enjoy!

Re: InGame v2.0

Post by _3D_ » 23 May 2017, 14:10

In this post I explain how to OCR digits https://autohotkey.com/boards/viewtopic.php?f=19&t=2400#p14243
There many many changes that I forgоt to post so:

Code: [Select all]GeSHi © Codebox Plus

ocrGetDigit(recBmp, color, varia, nores:= "") {
static _i:= 10, _bmp:= [] ;still not possible initializing static
;first time loop 10
;second time loop 0 => no loop by language default
Loop _i
_bmp[_i]:= Gdip_CreateBitmapFromFile(".\ocr\" --_i ".bmp") ;it work perfect
Loop 10
if ocrBWCompare(recBmp, _bmp[A_Index-1], color, varia), return A_Index-1
return nores ;added extra return if no match
}
Shorter code - just optimized - there only one arithmetic operation in first loop (--_i) for both sides.

Code: [Select all]GeSHi © Codebox Plus

			mX:=X+295, mY:=Y+147, itemP:= "" ;ocr item price RED digits
loop 10 {
bmp:= Gdip_BitmapFromScreen(mX "|" mY "|5|7")
itemP .= ocrGetDigit(bmp, 0xFF0000, 50, 0) ;concatenate as string
Gdip_DisposeImage(bmp)
mX += (mod(A_Index, 3) == 1)? 9: 6
}
itemP += 0 ;force conversion to value
Shorter code - the same - calculations is replaced to concatenation and added forced conversion to value (simple enough).
Enjoy!

Top