Hi all, my first post here so let me know if this is in the wrong thread or any rules are being broken.
I'm trying to write a script that will read preferably a single text file (though not adverse to reading multiple ones) that displays a W-L-D record for a stream overlay. I can easily make separate, individual scripts with hotkeys for wins, losses and draws. But the output of those scripts would be three individual text windows in OBS. I'm wondering if it's possible to make a single script with a single text file, where I could have hotkeys to adjust the three variables, and another hotkey to reset them all.
I want the output from the text file to look something like this, with the hyphens if possible:
W - L - D
# - # - #
I've tried various things, but none seem to work. Wondering if any of you guys have insight. Thanks!
Win - Loss - Draw Counter for OBS Overlay
Re: Win - Loss - Draw Counter for OBS Overlay
It is. You'll need to make a GUI with transparent background (I guess), that has 3 text controls (can even have different controls), each displaying their corresponding variable. GuiControl allows to modify controls on the go, without recreating the GUI window.
Use
Code: Select all
[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
Re: Win - Loss - Draw Counter for OBS Overlay
I read the post at least 5 times and still cannot see what actually is needed . Do you want to " read " a file and display it like SirRFI is guessing on screen in an ahk OSD window ? Or do you want to " create a file " with values that can be updated in realtime to use them to display them using the OBS software . Also are those values numbers like 12-2-0 ?You'll need to make a GUI with transparent background (I guess)
Re: Win - Loss - Draw Counter for OBS Overlay
Here is the basics:
Code: Select all
#SingleInstance force
#NoEnv
; Set up Gui
Gui, Add, Text, xm w100, Num Played
Gui, Add, Text, x+5 w50 vNumPlayed
Gui, Add, Text, xm w100, Num Wins
Gui, Add, Text, x+5 w50 vNumWins
Gui, Add, Text, xm w100, Num Loss
Gui, Add, Text, x+5 w50 vNumLoss
Gui, Add, Text, xm w100, Win Percent
Gui, Add, Text, x+5 w50 vWinPercent
Gui, Add, Text, xm w100, Lose Percent
Gui, Add, Text, x+5 w50 vLosePercent
; Read values from disk
IniRead, NumPlayed, WinLoss.ini, Stats, NumPlayed, 0
IniRead, NumWins, WinLoss.ini, Stats, NumWins, 0
IniRead, NumLoss, WinLoss.ini, Stats, NumLoss, 0
; Display values in GUI
GoSub, CalculateStats
Gui, Show
return
GuiClose:
ExitApp
; Win
Numpad7::
NumpadHome::
NumWins++
NumPlayed++
GoSub, CalculateStats
return
; Loss
Numpad8::
NumpadUp::
NumLoss++
NumPlayed++
GoSub, CalculateStats
return
; Reset
Numpad0::
NumpadIns::
NumWins := 0
NumLoss := 0
NumPlayed := 0
GoSub, CalculateStats
return
CalculateStats:
; Calculate stats
Multiplier := 100 / NumPlayed
WinPercent := Round(Multiplier * NumWins, 2)
LosePercent := Round(Multiplier * NumLoss, 2)
; Update GuiControls
GuiControl, , NumPlayed, % NumPlayed
GuiControl, , NumWins, % NumWins
GuiControl, , NumLoss, % NumLoss
GuiControl, , WinPercent, % WinPercent " %"
GuiControl, , LosePercent, % LosePercent " %"
; Write new values to disk
IniWrite, % NumPlayed, WinLoss.ini, Stats, NumPlayed
IniWrite, % NumWins, WinLoss.ini, Stats, NumWins
IniWrite, % NumLoss, WinLoss.ini, Stats, NumLoss
return
Who is online
Users browsing this forum: ccqcl, Descolada, inseption86, mikeyww and 387 guests