Jump to content

Recommended Posts

Posted

I am trying to make a simple game. What i want is when evertime someone hit "w" it would set point to 100 and play the soundfile and also increment the points and display them as i hit "w". also like to add more condition to if someone hit "w" more than 3 times, it would play a different sound file, like tripple combo for 3 hits in a roll. etc

#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
;Sleep ( 250 )
    If _IsPressed("57", $dll) Then
        SoundPlay("headshot.mp3",0)
    EndIf
WEnd
DllClose($dll)
Posted

Like This?

#include <Misc.au3>

Global $points = 0

While 1
    ToolTip("Points: "&$Points, 0, 0)
    Sleep(100)
    If _IsPressed("57") Then
        $Points = $Points + 100
        ToolTip("Points: "&$Points, 0, 0)
    EndIf
WEnd

Would be alot cleaner if you used HotKeySet()

Posted

depends on what 57 is, a lot of the keys on the keyboard are not available with hotkeyset as far as I know, i'd really like to see a full list my self

57 is "w", and that is available with hotkeyset

the only disadvantage is that hotkeyset would steal the key from other uses, so it wouldn't actually send "w"

Posted

Like This?

#include <Misc.au3>

Global $points = 0

While 1
    ToolTip("Points: "&$Points, 0, 0)
    Sleep(100)
    If _IsPressed("57") Then
        $Points = $Points + 100
        ToolTip("Points: "&$Points, 0, 0)
    EndIf
WEnd

Would be alot cleaner if you used HotKeySet()

I dont think the ToolTip("Points: "&$Points, 0, 0) do anything for me. is there a way to show the counts actively? maybe a GUI or something. also the key ID you can find in your help file if you search for ispressed.

Posted

Or more like this?

#include <Misc.au3>

Global $Points

While 1
    ToolTip("Points: " & $Points, 0, 0)
    Sleep(100)
    If _IsPressed("57") Then
        $Points += 1
        If $Points = 1 Then
            ;PlaySound HeadShot
            ConsoleWrite("HeadShot" & @CRLF)
        ElseIf $Points = 2 Then
            ;PlaySound Double Kill
            ConsoleWrite("Double Kill" & @CRLF)
        ElseIf $Points = 3 Then
            ;PlaySound Un Stoppable
            ConsoleWrite("Un Stoppable" & @CRLF)
        EndIf
    EndIf
WEnd
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Posted

Or more like this?

#include <Misc.au3>

Global $Points

While 1
    ToolTip("Points: " & $Points, 0, 0)
    Sleep(100)
    If _IsPressed("57") Then
        $Points += 1
        If $Points = 1 Then
            ;PlaySound HeadShot
            ConsoleWrite("HeadShot" & @CRLF)
        ElseIf $Points = 2 Then
            ;PlaySound Double Kill
            ConsoleWrite("Double Kill" & @CRLF)
        ElseIf $Points = 3 Then
            ;PlaySound Un Stoppable
            ConsoleWrite("Un Stoppable" & @CRLF)
        EndIf
    EndIf
WEnd
need umm to reset counter if any other is press heh
Posted (edited)

need umm to reset counter if any other is press heh

#include <Misc.au3>

Global $Points

While 1
    ToolTip("Points: " & $Points, 0, 0)
    Sleep(100)
    If _IsPressed("57") Then
        $Points += 1
        If $Points = 1 Then
            ;PlaySound HeadShot
            ConsoleWrite("HeadShot" & @CRLF)
        ElseIf $Points = 2 Then
            ;PlaySound Double Kill
            ConsoleWrite("Double Kill" & @CRLF)
        ElseIf $Points = 3 Then
            ;PlaySound Un Stoppable
            ConsoleWrite("Un Stoppable" & @CRLF)
        ElseIf $Points < 1 or $Points >3 Then
            Consolewrite("whatever" & @CRLF)
        EndIf
    EndIf
WEnd
oÝ÷ ØêÜj{X¢èìº×hjëh×6
    Else
                Consolewrite("whatever" & @CRLF)

?

Edited by bigassmuffin

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...