Focus Training for Peripheral Vision (Eye training)

Post gaming related scripts
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Focus Training for Peripheral Vision (Eye training)

Post by Kenzis » 02 Jun 2023, 13:56

I've created a script which is similar to this video, Reason being because the video has artifacts. :bravo:

Controls
F1 or ALT + F4 to Exit the script
Edit the delay between images in the config file

Problems yet to be fixed : :crazy:
  • Flickering after the first image.
  • Making SoundPlay actually work.
Also im sorry for the installation being so trash.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetBatchLines, -1
Process, Priority,, High
; The delay between image sorts can be changed within the >>>config.txt<<<, default is 40
;-------------------------------------------------------------------------------------------------------------------------------------------------
;  I've included the beat sound but The beat sound doesn't work, if anyone want's to try and make it work, you're free to do so, if anything you'd 
; help everyone allot
;  I can't seem to understand why it won't play the sound when i use SoundPlay between GUI's, that's the problem.
; Also the memory aloccation hasn't been much experimented, if the program crashes, it's probably because your RAM has been overloaded.
;  To test this, one must keep the program up for a long time, but since i can't see with task manager because i must use +AlwaysOnTop
; It is practially impossible for me to see if it is correctly destroying the older Images. I can only see if it crashes the app, but that's >
; < Boring AF.

IfNotExist, %A_ScriptDir%\data
{
MsgBox, THE DATA FOLDER DOESN'T EXIST, The program will shutdown.
ExitApp
}

IfNotExist, %A_ScriptDir%\config.txt
{
MsgBox, THE CONFIG DOESN'T EXIST, Skipping the FileReadLine and the Default Delay will be 40ms.
Delay := 40
goto, skip
}

;ReadConfig
FileReadLine, DelayBetweenImages, %A_ScriptDir%\config.txt, 1

;Sleep amount in ms?
Delay := DelayBetweenImages

skip:
;Scripts name
scriptname := A_ScriptName

;Pictures dir, sound dir and value stored for directories.
picture = %A_ScriptDir%\data\0.png
1p = %A_ScriptDir%\data\1.png
2p = %A_ScriptDir%\data\2.png
3p = %A_ScriptDir%\data\3.png
4p = %A_ScriptDir%\data\4.png
5p = %A_ScriptDir%\data\5.png
6p = %A_ScriptDir%\data\6.png
7p = %A_ScriptDir%\data\7.png
8p = %A_ScriptDir%\data\8.png
9p = %A_ScriptDir%\data\9.png
10p = %A_ScriptDir%\data\10.png
11p = %A_ScriptDir%\data\11.png
12p = %A_ScriptDir%\data\12.png
13p = %A_ScriptDir%\data\13.png
14p = %A_ScriptDir%\data\14.png
15p = %A_ScriptDir%\data\15.png
16p = %A_ScriptDir%\data\16.png

;Timer for the pictures
SetTimer, pictureload, Off

;Set if window type coords
windowh := A_ScreenHeight
windoww := A_ScreenWidth
mscreenh := A_ScreenHeight - (A_ScreenHeight / 2) - 10
mscreenw := A_ScreenWidth - (A_ScreenWidth / 2) - 10

;Loading GUI, or fake gui
gui, B:new, -border -sysmenu -caption

;Starting GUI, Background
gui, BG:new, -border -sysmenu -caption
gui, BG:font, s20 b700, Impact
gui, BG:add, button, x%mscreenw% y%mscreenh% w80 h30 gstart, START
gui, BG:show, x0 y0 w%windoww% h%windowh%, %scriptname%
Return

;Starting the play :D
start:
gui, B:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, BG:new, -border -sysmenu -caption
gui, BG:add, picture, x0 y0, %picture%
gui, BG:show, x0 y0 w%windoww% h%windowh%, %scriptname%

;Start pictureload timer also Change the BG and B to one with 1p picture
gui, BG:add, picture, x0 y0, %1p%
gui, B:add, picture, x0 y0, %1p%
SetTimer, pictureload, 0


;Load the pictures and simulate a window with defined fps.
pictureload:
{
picture := 1p
gui, bgpic1:New, -border -sysmenu -Caption
gui, bgpic1:margin, 0, 0
gui, bgpic1:add, picture, x0 y0, %picture%
gui, bgpic1:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic1:+AlwaysOnTop
picture := 2p
Sleep, %Delay%
gui, bgpic2:New, -border -sysmenu -Caption
gui, bgpic2:margin, 0, 0
gui, bgpic2:add, picture, x0 y0, %picture%
gui, bgpic2:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic2:+AlwaysOnTop
picture := 3p
Sleep, %Delay%
gui, bgpic3:New, -border -sysmenu -Caption
gui, bgpic3:margin, 0, 0
gui, bgpic3:add, picture, x0 y0, %picture%
gui, bgpic3:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic3:+AlwaysOnTop
picture := 4p
Sleep, %Delay%
gui, bgpic4:New, -border -sysmenu -Caption
gui, bgpic4:margin, 0, 0
gui, bgpic4:add, picture, x0 y0, %picture%
gui, bgpic4:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic4:+AlwaysOnTop
picture := 5p
Sleep, %Delay%
gui, bgpic5:New, -border -sysmenu -Caption
gui, bgpic5:margin, 0, 0
gui, bgpic5:add, picture, x0 y0, %picture%
gui, bgpic5:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic5:+AlwaysOnTop
picture := 6p
Sleep, %Delay%
gui, bgpic6:New, -border -sysmenu -Caption
gui, bgpic6:margin, 0, 0
gui, bgpic6:add, picture, x0 y0, %picture%
gui, bgpic6:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic6:+AlwaysOnTop
picture := 7p
Sleep, %Delay%
gui, bgpic7:New, -border -sysmenu -Caption
gui, bgpic7:margin, 0, 0
gui, bgpic7:add, picture, x0 y0, %picture%
gui, bgpic7:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic7:+AlwaysOnTop
picture := 8p
Sleep, %Delay%
gui, bgpic8:New, -border -sysmenu -Caption
gui, bgpic8:margin, 0, 0
gui, bgpic8:add, picture, x0 y0, %picture%
gui, bgpic8:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic8:+AlwaysOnTop
picture := 9p
Sleep, %Delay%
gui, bgpic9:New, -border -sysmenu -Caption
gui, bgpic9:margin, 0, 0
gui, bgpic9:add, picture, x0 y0, %picture%
gui, bgpic9:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic9:+AlwaysOnTop
picture := 10p
Sleep, %Delay%
gui, bgpic10:New, -border -sysmenu -Caption
gui, bgpic10:margin, 0, 0
gui, bgpic10:add, picture, x0 y0, %picture%
gui, bgpic10:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic10:+AlwaysOnTop
picture := 11p
Sleep, %Delay%
gui, bgpic11:New, -border -sysmenu -Caption
gui, bgpic11:margin, 0, 0
gui, bgpic11:add, picture, x0 y0, %picture%
gui, bgpic11:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic11:+AlwaysOnTop
picture := 12p
Sleep, %Delay%
gui, bgpic12:New, -border -sysmenu -Caption
gui, bgpic12:margin, 0, 0
gui, bgpic12:add, picture, x0 y0, %picture%
gui, bgpic12:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic12:+AlwaysOnTop
picture := 13p
Sleep, %Delay%
gui, bgpic13:New, -border -sysmenu -Caption
gui, bgpic13:margin, 0, 0
gui, bgpic13:add, picture, x0 y0, %picture%
gui, bgpic13:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic13:+AlwaysOnTop
picture := 14p
Sleep, %Delay%
gui, bgpic14:New, -border -sysmenu -Caption
gui, bgpic14:margin, 0, 0
gui, bgpic14:add, picture, x0 y0, %picture%
gui, bgpic14:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic14:+AlwaysOnTop
picture := 15p
Sleep, %Delay%
gui, bgpic15:New, -border -sysmenu -Caption
gui, bgpic15:margin, 0, 0
gui, bgpic15:add, picture, x0 y0, %picture%
gui, bgpic15:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic15:+AlwaysOnTop
picture := 16p
Sleep, %Delay%
gui, bgpic16:New, -border -sysmenu -Caption
gui, bgpic16:margin, 0, 0
gui, bgpic16:add, picture, x0 y0, %picture%
gui, bgpic16:show, x0 y0 w%windoww% h%windowh%, %scriptname%
gui, bgpic16:+AlwaysOnTop
Sleep, %Delay%
SetTimer, freealocmem, 0
SetTimer, pictureload, Off
}

freealocmem:
{
Gui, bgpic15:Destroy
Gui, bgpic1:Destroy
Gui, bgpic2:Destroy
Gui, bgpic14:Destroy
Gui, bgpic13:Destroy
Gui, bgpic12:Destroy
Gui, bgpic11:Destroy
Gui, bgpic10:Destroy
Gui, bgpic9:Destroy
Gui, bgpic8:Destroy
Gui, bgpic7:Destroy
Gui, bgpic6:Destroy
Gui, bgpic5:Destroy
Gui, bgpic4:Destroy
Gui, bgpic3:Destroy
Gui, bgpic16:Destroy
SetTimer, freealocmem, Off
SetTimer, pictureload, 0
}

;Close the app with F1
F1::
ExitApp

;Close the app with Alt + F4
!F4::
IfWinActive, %scriptname%
ExitApp
Example https://imgur.com/a/GkNWOOv
Attachments
Focus Training for Peripheral Vision 1.0.rar
Read the ReadMe txt for install instructions.
(2.78 KiB) Downloaded 59 times
data2.rar
Extract the data folder into the Focus Training folder
(1.14 MiB) Downloaded 51 times
data1.rar
Extract the data folder into the Focus Training folder
(1.28 MiB) Downloaded 56 times

Return to “Gaming Scripts (v1)”