ProgressBar mit Taste starten

Stelle Fragen zur Automatisierung von Spielen

Moderator: jNizM

Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

ProgressBar mit Taste starten

13 Nov 2016, 09:54

Guten Tag,

ich habe für ein MMO Spiel folgende idee.
Ich möchte wenn ich zb die Taste F2 drücke das eine Fähigkeit aktiviert wird mit send, 2
und eine Progress bar startet die in 30 sekunden voll ist.
Nun habe ich folgendes gefunden, jedoch wenn ich zb F3 drücke startet die 2. Bar und die erste hört auf was gemäß code auch logisch ist aber wie kann ich das ändern?
Der erste balken soll ganz normal weiterlaufen unabhängig davon ob ich F3 drücke oder F2 drücke.

Code: Select all

Gui,1:Add,Progress,    x10  y10 w400 h20  vPRBAR cFF7200
Gui,1:Add,Text, cBlack x10  y10 w400 h20 +0x200 +Center +BackgroundTrans vText22,        ;here empty 
Gui,1:Add,Progress,    x10  y40 w400 h20  vPRBAR1 cFF7200
Gui,1:Add,Text, cBlack x10  y40 w400 h20 +0x200 +Center +BackgroundTrans vText33,        ;here empty 
Gui,1:Show, w400 h200 , 

F2::
GuiControl,, PRBAR, 0
loop, 100
{
 GuiControl,, PRBAR, +1
 GuiControl,1:,Text22,%A_Index%    ;to fill progressbar later
 sleep, 60
}

Return

F3::
GuiControl,, PRBAR1, 0
loop, 100
{
 GuiControl,, PRBAR1, +1
 GuiControl,1:,Text33,%A_Index%    ;to fill progressbar later
 sleep, 60
}

Return
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: ProgressBar mit Taste starten

22 Feb 2018, 20:42

jemand eine idee?
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: ProgressBar mit Taste starten

23 Feb 2018, 02:38

Du müsstest SetTimer anstatt Loop verwenden.
Recommends AHK Studio
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: ProgressBar mit Taste starten

23 Feb 2018, 05:26

Versuch mal:

Code: Select all

#NoEnv
#SingleInstance, Force

    global Timer2 := Func("incrementBar").Bind(2)
    global Timer3 := Func("incrementBar").Bind(3)

    BarOptions = cFF7200 w400 h50
    TextOptions = xp yp wp hp Center BackgroundTrans 0x200 ; SS_CENTERIMAGE

    Gui, Add, Progress, vBarF2 %BarOptions%
    Gui, Add, Text,     vTxtF2 %TextOptions%
    Gui, Add, Progress, vBarF3 %BarOptions%
    Gui, Add, Text,     vTxtF3 %TextOptions%
    Gui, Show

Return

GuiClose:
ExitApp

F2:: startBar(2)
F3:: startBar(3)


;-------------------------------------------------------------------------------
startBar(n) { ; start bar number n
;-------------------------------------------------------------------------------
    GuiControl,, BarF%n%, 0
    SetTimer, % Timer%n%, 10
}


;-------------------------------------------------------------------------------
incrementBar(n) { ; increment bar number n
;-------------------------------------------------------------------------------
    GuiControl,, BarF%n%, +1
    GuiControlGet, Count,, BarF%n%
    GuiControl,, TxtF%n%, %Count%

    If (Count = 100)
        SetTimer, % Timer%n%, Off
}
Ich hoffe das hilft.
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: ProgressBar mit Taste starten

23 Feb 2018, 15:06

wow wolf dankeschööön es funktioniert super! :D

Return to “Spiele”

Who is online

Users browsing this forum: No registered users and 14 guests