Buzzer mit Buzz Problem Topic is solved

Stelle Fragen zur Automatisierung von Spielen

Moderator: jNizM

Scizzo

Buzzer mit Buzz Problem

21 Jan 2021, 16:07

Guten Tag,

bin neu hier und neu mit AHK unterwegs. Muss erstmal sagen ist echt genieal und vieles erklärt sich von selbst aber leider bin ich jetzt auf ein Problem gestoßen und hoffe ihr könnt mir helfen.
Erst einmal zu meinem Projekt. Ich möchte gerne 3 Buzzer von dem PS2 Game Buzz nutzen und diese auswerten und gegeninander sperren. Heißt wenn einer Buzzer eins drückt öffnet sich ein Fenster mit der Farbe Rot und Buzzer zwei sowie drei können nicht mehr gedrückt werden oder die Funktion getriggert. genauso anders herum. Die Buzzer sollen durch schließen des GUI wieder freigegeben werden. Ich hoffe ihr versteht mein Problem. Hier mein code.

Code: Select all

#NoTrayIcon

InputBox, spieler1 , Spieler 1, Name von Spieler 1 Farbe Rot, Breite, Höhe, X, Y, Locale, 2147483,
InputBox, spieler2 , Spieler 2, Name von Spieler 2 Farbe Blau, Breite, Höhe, X, Y, Locale, 2147483,
InputBox, spieler3 , Spieler 3, Name von Spieler 3 Farbe Grün, Breite, Höhe, X, Y, Locale, 2147483,


Gui, +AlwaysOnTop
Gui, Add, Picture, x0 y0 w1024 h768 , hintergrund.jpg
Gui, Add, Picture, x0 y0 w1024 h150 , logo.jpg

Gui, Font, S16 CDefault, Comic Sans MS
Gui, Add, Text, x100 y250 w350 h30 BackgroundTrans , Roter Buzzer
Gui, Add, Text, x100 y280 w350 h30 BackgroundTrans , %spieler1%


Gui, Add, Text, x100 y400 w350 h30 BackgroundTrans , Blauer Buzzer
Gui, Add, Text, x100 y430 w350 h30 BackgroundTrans , %spieler2%


Gui, Add, Text, x100 y550 w350 h30 BackgroundTrans , Grüner Buzzer
Gui, Add, Text, x100 y580 w350 h30 BackgroundTrans , %spieler3%

Gui, Show,  h768 w1024, Nerdquiz
Return

#SingleInstance ignore

Joy1::Run s1.ahk
Joy6::Run s2.ahk
Joy11::Run s3.ahk

GuiClose:
esc::ExitApp

Code: Select all

#NoTrayIcon

Gui, Color, ff0000
Gui, -caption +AlwaysOnTop
Gui, Font, S24 CDefault, arial
Gui, Add, Text, w920 h350 , Spieler1
Gui, Show, x142 y134 h742 w1437, Spieler 1
return


Joy1::Suspend
Joy6::Suspend
Joy11::Suspend

#SingleInstance ignore

Space::ExitApp

Code: Select all

#NoTrayIcon


Gui, Color, 0000ff
Gui, -Caption +AlwaysOnTop
Gui, Font, S24 CDefault Bold, arial
Gui, Add, Text, w920 h350 , Spieler 2
Gui, Show, x142 y134 h742 w1437, Player 2
return


Joy1::Suspend
Joy6::Suspend
Joy11::Suspend

#SingleInstance ignore

Space::ExitApp

Code: Select all

#NoTrayIcon


Gui, Color, 00ff00
Gui, -Caption +AlwaysOnTop
Gui, Font, S24 CDefault Bold, arial
Gui, Add, Text, w920 h350 , Spieler 3
Gui, Show, x142 y134 h742 w1437, Player 3
return


Joy1::Suspend
Joy6::Suspend
Joy11::Suspend

#SingleInstance ignore

Space::ExitApp
Last edited by BoBo on 21 Jan 2021, 18:20, edited 1 time in total.
Reason: Nach 'Spiele' verschoben.
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem

23 Jan 2021, 12:28

Haben sich schon viele angeschaut aber niemand konnte bisher helfen. Fehlen irgendwelche Informationen müsst ihr noch irgendetwas von mir wissen? Probiere als weiter aber bekomme das Problem nicht gelöst...immer wenn ich einen Buzzer drücke kann man die anderen weiterhin auch aktivieren.

Ich hoffe mir kann jemand helfen.
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem  Topic is solved

25 Jan 2021, 16:20

@jNizM könntest du mir sagen ob ich irgendetwas falsch mache? Muss ich meine Fragestellung anpassen oder das Thema wo anders einstellen? Find es echt schade keine Hilfe zu bekommen.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Buzzer mit Buzz Problem

26 Jan 2021, 05:59

Wie genau hast du es jetzt gelöst? :think:
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem

26 Jan 2021, 09:13

BoBo wrote:
26 Jan 2021, 05:59
Wie genau hast du es jetzt gelöst? :think:
Der Code sieht noch gleich aus, hab immer wieder alles zurück auf den Stand gebracht wenn eine Möglichkeit die ich erhofft hatte das Sie funktioniert nicht funktioniert hat.
Wollte nachher nochmal versuchen das eine Variable auf 1 gesetzt wird wenn ein bestimmter Buzzer betätigt wird und dadurch eine if Schleife startet aber da muss ich mich erst einmal einlesen. Hatte gehofft es gäbe eine leichtere Lösung die verschiedenen Scripte gegeneinander zu sperren.
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem

26 Jan 2021, 12:05

Hab echt Probleme....

Wieso schreibt er mir so keinen Wert in meine Variable? Oder wieso öffnet er das Bild nicht wenn die Variable geschrieben sein sollte?

Code: Select all

Joy1:: spieler1dran++

Joy6:: spieler2dran := 1

Joy11:: spieler3dran := 1


if (spieler1dran > 0)
{
Gui, Add, Picture, x0 y0 w1024 h768, button-red.png
}
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem

26 Jan 2021, 13:21

Okay hab jetzt nen schönen schlanken Code der funktioniert aber wieder das Problem, dass die Buzzer der jeweiligen Spieler gegeneinander nicht gesperrt sind hat einer eine Idee wie man das umsetzen könnte?

Code: Select all

#NoTrayIcon

InputBox, spieler1 , Spieler 1, Name von Spieler 1 Farbe Rot, Breite, 250, X, Y, Locale, 2147483,
InputBox, spieler2 , Spieler 2, Name von Spieler 2 Farbe Blau, Breite, 250, X, Y, Locale, 2147483,
InputBox, spieler3 , Spieler 3, Name von Spieler 3 Farbe Grün, Breite, 250, X, Y, Locale, 2147483,

Gui, +AlwaysOnTop
Gui, Add, Picture, x0 y0 w1024 h768 , hintergrund.jpg
Gui, Add, Picture, x0 y0 w1024 h150 , logo.jpg

Gui, Font, S16 CDefault, Comic Sans MS
Gui, Add, Text, x100 y250 w350 h30 BackgroundTrans , Roter Buzzer
Gui, Add, Text, x100 y280 w350 h30 BackgroundTrans , %spieler1%


Gui, Add, Text, x100 y400 w350 h30 BackgroundTrans , Blauer Buzzer
Gui, Add, Text, x100 y430 w350 h30 BackgroundTrans , %spieler2%


Gui, Add, Text, x100 y550 w350 h30 BackgroundTrans , Grüner Buzzer
Gui, Add, Text, x100 y580 w350 h30 BackgroundTrans , %spieler3%

Gui, Show,  h768 w1024, Nerdquiz


~Joy1::
sp1 := 1
gosub check

return

~Joy6:: 
sp2 := 1
gosub check

return

~Joy11:: 
sp3 := 1
gosub check

return

check:
if (sp1=1)	
	RunWait s1.ahk

else if (sp2=1)
	RunWait s2.ahk

else if (sp3=1)
	RunWait s3.ahk

return	

GuiClose:
esc::ExitApp
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem

30 Jan 2021, 15:10

Kann mir jemand in diesem Forum helfen oder kann hier keiner besser als ich mit AHK umgehen? :roll:
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Buzzer mit Buzz Problem

30 Jan 2021, 20:20

Falls sich hier tatsächlich niemand findet (Nope, ich bin's nicht) - Schulenglisch zusammenkratzen und erneut unter 'Ask For Help' > 'Gaming' posten. Good luck :)
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: Buzzer mit Buzz Problem

31 Jan 2021, 10:02

Futter für die Hungrigen :

Code: Select all

Gui, Add, Picture, x0 y0 vb1, button-red.png
Gui, Add, Picture, x0 y0 vb2, button-green.png
Gui, Add, Picture, x0 y0 vb3, button-blue.png
;GuiControl, Hide, b1
;GuiControl, Hide, b2
;GuiControl, Hide, b3
;gui,show

a:: buzzbutton("red")
b:: buzzbutton("green")
c:: buzzbutton("blue")
d:: buzzbutton("hide")

return

esc::
Guiclose:
ExitApp

buzzbutton(color){
	gui,show
	Switch color
	{
      Case "red":
         GuiControl, Hide, b2
         GuiControl, Hide, b3      
         GuiControl, Show, b1
      Case  "green":
         GuiControl, Hide, b1
         GuiControl, Hide, b3    
         GuiControl, Show, b2
      Case  "blue":
         GuiControl, Hide, b1
         GuiControl, Hide, b2      
         GuiControl, Show, b3
      Case  "hide":
         Gui, hide		
	}	
}
Scizzo
Posts: 14
Joined: 23 Jan 2021, 12:14

Re: Buzzer mit Buzz Problem

31 Jan 2021, 11:30

haichen wrote:
31 Jan 2021, 10:02
Futter für die Hungrigen :

Code: Select all

Gui, Add, Picture, x0 y0 vb1, button-red.png
Gui, Add, Picture, x0 y0 vb2, button-green.png
Gui, Add, Picture, x0 y0 vb3, button-blue.png
;GuiControl, Hide, b1
;GuiControl, Hide, b2
;GuiControl, Hide, b3
;gui,show

a:: buzzbutton("red")
b:: buzzbutton("green")
c:: buzzbutton("blue")
d:: buzzbutton("hide")

return

esc::
Guiclose:
ExitApp

buzzbutton(color){
	gui,show
	Switch color
	{
      Case "red":
         GuiControl, Hide, b2
         GuiControl, Hide, b3      
         GuiControl, Show, b1
      Case  "green":
         GuiControl, Hide, b1
         GuiControl, Hide, b3    
         GuiControl, Show, b2
      Case  "blue":
         GuiControl, Hide, b1
         GuiControl, Hide, b2      
         GuiControl, Show, b3
      Case  "hide":
         Gui, hide		
	}	
}
Danke dir für deinen Ansatz! Funktioniert aber soweit bin ich quasie mit einer anderen Lösung. Meine Frage ist ja wie kann ich verhindern das wenn jemand a drückt b und c nicht mehr drücken können oder quasie wenn Sie drücken sich Ihr Bild nicht öffnet? Sondern erst, wenn man über d zurückgesetzt hat?
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: Buzzer mit Buzz Problem

02 Feb 2021, 03:10

Vielleicht so?
STRG+d befreit den buzzer wieder. Für die nächste Runde.

Code: Select all

Gui, Add, Picture, x0 y0 vb1, button-red.png
Gui, Add, Picture, x0 y0 vb2, button-green.png
Gui, Add, Picture, x0 y0 vb3, button-blue.png
GuiControl, Hide, b1
GuiControl, Hide, b2
GuiControl, Hide, b3
gui,show

a:: buzzbutton("red")
b:: buzzbutton("green")
c:: buzzbutton("blue")
^d:: buzzbutton("free") 

return


esc::
Guiclose:
ExitApp

buzzbutton(color){
   static buzz:=0
   if (color="free")
   {
      buzz:=0
      GuiControl, Hide, b1
      GuiControl, Hide, b2      
      GuiControl, Hide, b3
      return
   }
   if Buzz:=!Buzz
   {
      Switch color
      {
         Case "red":
            GuiControl, Hide, b2
            GuiControl, Hide, b3      
            GuiControl, Show, b1
         Case  "green":
            GuiControl, Hide, b1
            GuiControl, Hide, b3    
            GuiControl, Show, b2
         Case  "blue":
            GuiControl, Hide, b1
            GuiControl, Hide, b2      
            GuiControl, Show, b3
      }	
   }
}

Return to “Spiele”

Who is online

Users browsing this forum: No registered users and 22 guests