Script does not working for reset

Ask gaming related questions
User avatar
CrowexBR
Posts: 12
Joined: 15 Apr 2024, 06:57

Script does not working for reset

18 Apr 2024, 10:10

I'm having trouble getting the script to reset after 3x NumpadDot + Numpad1 .
Can someone help me to solve this problem?

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance force

global first_notice := false
global second_notice := false

first_notice_msg := "/m [P.R.F] PLEASE, WE REQUEST YOUR COLLABORATION FOR A QUICK INSPECTION. Use /RENDER"
second_notice_msg := "/m [P.R.F] MANDATORY APPROACH. STOP AND EXIT THE VEHICLE AND USE /RENDER"
third_notice_msg := "/m [P.R.F] STOP IMMEDIATELY OR YOU WILL BE PUNISHED FOR DOP AND ESCAPE. LAST WARNING"

SendNotice(notice) {
    SendText(notice)
    Sleep 50
    Send "{Enter}"
    Sleep 2500
}

ResetNotices() {
    global first_notice
    global second_notice
    first_notice := false
    second_notice := false
}

NumpadDot & Numpad1:: {
    global first_notice
    global second_notice
    if (first_notice) {
        SendNotice(first_notice_msg)
        first_notice := false
        return
    } else if (second_notice) {
        SendNotice(second_notice_msg)
        second_notice := false
    } else {
        ResetNotices()
        SendNotice(third_notice_msg)
        ResetNotices()
        return
    }
}
User avatar
boiler
Posts: 17120
Joined: 21 Dec 2014, 02:44

Re: Script does not working for reset

18 Apr 2024, 11:07

You haven't implemented any logic that would have it step through the notices. No where are you assigning true to either first_notice or second_notice, so your first two if conditions will always be false.

It would seem easier, btw, to just have one variable like notice_level that you would just assign a different number to and check that number rather than changing the value of two different variables.
User avatar
CrowexBR
Posts: 12
Joined: 15 Apr 2024, 06:57

Re: Script does not working for reset

18 Apr 2024, 11:42

boiler wrote:
18 Apr 2024, 11:07
You haven't implemented any logic that would have it step through the notices. No where are you assigning true to either first_notice or second_notice, so your first two if conditions will always be false.

It would seem easier, btw, to just have one variable like notice_level that you would just assign a different number to and check that number rather than changing the value of two different variables.
Thanks for reply.

I've already fixed the true and false, everything went fine.

Now, here's the thing, how do I make it so that when the script runs, it copies where I have a number ready, and then it sends it to the variable suspect = [value] because of the clipboard isn't working for v2.0. Can you help?

My old script is:

Code: Select all

NumpadDot & Numpad1::
Clipboard := ""
Sleep, 100
Send, ^a
Send, ^x
ClipWait
Sleep, 100
suspect := Clipboard
return
How to update for v2.0?
User avatar
boiler
Posts: 17120
Joined: 21 Dec 2014, 02:44

Re: Script does not working for reset

18 Apr 2024, 13:01

CrowexBR wrote: …because of the clipboard isn't working for v2.0.
The clipboard does work in v2. The built-in variable name is A_Clipboard.

Return to “Gaming”

Who is online

Users browsing this forum: amneet and 6 guests