AutoHotkey Community

It is currently May 26th, 2012, 4:38 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: March 29th, 2009, 7:16 pm 
Offline

Joined: March 25th, 2009, 5:15 pm
Posts: 17
Right now all I really have is a GUI. The calculator is meant to be used to find out a persons kill ratios in a first person shooter game or other game. There are 4 edit fields for Kills, Deaths, Head Shots and Assists.
There are 4 read only edit fields which are assists/kills, kills/deaths, HeadShots/kills, and a slightly harder equation which will tell you how many more kills you need before your kill/death ration goes up by 0.01%.
Could anyone help me out?

Code:
#NoEnv
#SingleInstance force
SendMode Input

Gui, Add, Text, x38 y52 w30 h15 +Right, Kills:
Gui, Add, Text, x28 y82 w40 h15 +Right, Deaths:
Gui, Add, Text, x8 y112 w60 h15 +Right, Head Shots:
Gui, Add, Text, x28 y142 w40 h15 +Right, Assists:

Gui, Add, Edit, x76 y110 w70 h20 vheadshot,
Gui, Add, Edit, x76 y140 w70 h20 vassist,
Gui, Add, Edit, x76 y80 w70 h20 vdeath,
Gui, Add, Edit, x76 y50 w70 h20 vkill,

Gui, Add, Text, x178 y52 w60 h15 +Right, Kill / Death:
Gui, Add, Text, x148 y82 w90 h15 +Right, Head Shots / Kills:
Gui, Add, Text, x168 y112 w70 h15 +Right, Assists / Kills:
Gui, Add, Text, x56 y10 w120 h30 , Kills Needed for +0.01`% Kill / Death Ratio

Gui, Add, Edit, x186 y15 w70 h20 vpossitivekill +ReadOnly,
Gui, Add, Edit, x246 y110 w70 h20 vakratio +ReadOnly,
Gui, Add, Edit, x246 y80 w70 h20 vhskratio +ReadOnly,
Gui, Add, Edit, x246 y50 w70 h20 vkdratio +ReadOnly,
Gui, Add, Button, x171 y140 w140 h20 vbutton, Calculate
Gui, Show, x600 y0 h186 w336, KD Calc
Return

/* (The variables for quick reference)
headshot   input
assist      input
death      input
kill      input
possitivekill   output
akration   output
hskratio   output
kdratio      output
button
*/

GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2009, 10:51 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5479
Location: the tunnel(?=light)
Is the 0.01% increase to be a reflection of a rounded ratio or only when the ratio itself will actually be equal to or greater than 0.01%?

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2009, 11:07 pm 
Offline

Joined: March 25th, 2009, 5:15 pm
Posts: 17
sinkfaze wrote:
Is the 0.01% increase to be a reflection of a rounded ratio or only when the ratio itself will actually be equal to or greater than 0.01%?


either way would be fine. if it turns out that it will show you need 45.2511 kills that would be fine


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 6:08 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5479
Location: the tunnel(?=light)
It seems that 0.01% is a very low threshold to cross, I have to obtain a wide difference in numbers to obtain an increase greater than 1. Could you post some sample statistics so I can get a better idea of what kind of math it should be doing?

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 9:25 am 
Offline

Joined: March 25th, 2009, 5:15 pm
Posts: 17
sinkfaze wrote:
It seems that 0.01% is a very low threshold to cross, I have to obtain a wide difference in numbers to obtain an increase greater than 1. Could you post some sample statistics so I can get a better idea of what kind of math it should be doing?


sure thing.

Kills - 53741
Deaths - 26081
Assists - 6429
Head Shots - 5325

once you hit calculate it should display:
Kill/Death ratio - 2.0605
Assists/Kills ratio - .1196
Head Shots/Kills ratio - .0991
Kills needed for next +0.01% Kill/Death ratio - 247 (I got this number by first finding the current kill death ratio then rounding down to the nerest 100th (2.06) then adding .01 (2.07) then multiplying by deaths (26081*2.07) then subtracting the current kills (53987.67-53741) and then rounding up to the nearest whole number (247).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 9:53 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Code:
Kills=53741
Deaths=26081
Assists=6429
HeadShots=5325
/*
once you hit calculate it should display:
Kill/Death ratio - 2.0605
Assists/Kills ratio - .1196
Head Shots/Kills ratio - .0991
Kills needed for next +0.01% Kill/Death ratio - 247
*/
; I got this number by first finding the current kill death ratio
res := Kills/Deaths
msgbox %res%
; then rounding down to the nerest 100th (2.06)
res := Floor(res*100) / 100
msgbox %res%
; then adding .01 (2.07)
res += 0.01
msgbox %res%
; then multiplying by deaths (26081*2.07)
res *= Deaths
msgbox %res%
; then subtracting the current kills (53987.67-53741) and
res -= Kills
msgbox %res%
; then rounding up to the nearest whole number (247).
res := Ceil(res)
MsgBox %res%

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2009, 2:27 am 
Offline

Joined: March 25th, 2009, 5:15 pm
Posts: 17
tonne wrote:
Code:
Kills=53741
Deaths=26081
Assists=6429
HeadShots=5325
/*
once you hit calculate it should display:
Kill/Death ratio - 2.0605
Assists/Kills ratio - .1196
Head Shots/Kills ratio - .0991
Kills needed for next +0.01% Kill/Death ratio - 247
*/
; I got this number by first finding the current kill death ratio
res := Kills/Deaths
msgbox %res%
; then rounding down to the nerest 100th (2.06)
res := Floor(res*100) / 100
msgbox %res%
; then adding .01 (2.07)
res += 0.01
msgbox %res%
; then multiplying by deaths (26081*2.07)
res *= Deaths
msgbox %res%
; then subtracting the current kills (53987.67-53741) and
res -= Kills
msgbox %res%
; then rounding up to the nearest whole number (247).
res := Ceil(res)
MsgBox %res%


thanks for that equation :)
now all I need help with is the easy equations and the calculate button


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2009, 4:32 am 
Offline

Joined: March 25th, 2009, 5:15 pm
Posts: 17
bump


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2009, 6:35 pm 
Offline

Joined: March 25th, 2009, 5:15 pm
Posts: 17
still need some help


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2009, 11:34 pm 
Offline

Joined: July 27th, 2008, 7:31 am
Posts: 47
Location: England
Don't tell me, you still need some help?

_________________
All scripts are untested unless otherwise mentioned.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 12:41 am 
Offline

Joined: July 27th, 2008, 7:31 am
Posts: 47
Location: England
Ok, I decided to help:

Code:
#NoEnv
#SingleInstance force
SendMode Input

Gui, Add, Text, x38 y52 w30 h15 +Right, Kills:
Gui, Add, Text, x28 y82 w40 h15 +Right, Deaths:
Gui, Add, Text, x8 y112 w60 h15 +Right, Head Shots:
Gui, Add, Text, x28 y142 w40 h15 +Right, Assists:

Gui, Add, Edit, x76 y110 w70 h20 vHeadshot,
Gui, Add, Edit, x76 y140 w70 h20 vAssist,
Gui, Add, Edit, x76 y80 w70 h20 vDeath,
Gui, Add, Edit, x76 y50 w70 h20 vKill,

Gui, Add, Text, x178 y52 w60 h15 +Right, Kill / Death:
Gui, Add, Text, x148 y82 w90 h15 +Right, Head Shots / Kills:
Gui, Add, Text, x168 y112 w70 h15 +Right, Assists / Kills:
Gui, Add, Text, x56 y10 w120 h30 , Kills Needed for +0.01`% Kill / Death Ratio

Gui, Add, Edit, x186 y15 w70 h20 vpossitivekill +ReadOnly,
Gui, Add, Edit, x246 y50 w70 h20 vkdratio +ReadOnly,
Gui, Add, Edit, x246 y80 w70 h20 vhskratio +ReadOnly,
Gui, Add, Edit, x246 y110 w70 h20 vakratio +ReadOnly,
Gui, Add, Button, x171 y140 w140 h20 vbutton, Calculate
Gui, Show, x600 y0 h186 w336, KD Calc
Return

ButtonCalculate:
Gui, Submit, NoHide

kd := Kill/Death
hsk := Headshot/Kill
ak := Assist/Kill

pk := Kill/Death
pk := Floor(pk*100) / 100
pk += 0.01
pk *= Death
pk -= Kill

GuiControl,, possitivekill, %pk%
GuiControl,, kdratio, %kd%
GuiControl,, hskratio, %hsk%
GuiControl,, akratio, %ak%
Return,

GuiClose:
ExitApp


Hope your thankful :P

Code has been tested and works

Edit: Thanks tonne for the equation to get %pk%. I couldn't be bothered!

_________________
All scripts are untested unless otherwise mentioned.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Miguel, notsoobvious, Yahoo [Bot] and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group