Jump to content
  • 0

How to make script wait for user action


HorridModz

Question

I want my script to ask the user for a value, then tell the user to click on the gameguardian icon again when the value changes. Basically, I want it to wait for gameguardian to be clicked on to run the next line of code. Here is what I want in code form:

 

gg.clearResults()

gg.alert("Go to the helicopter and click on an order.")

local gold = gg.prompt({'How much gold does this helicopter order give?'}, nil, {'text'})

gg.searchNumber(hi, gg.TYPE_DWORD)

gg.alert("Delete this order and speed up the next one. Then click the gameguardian icon again.")

(CLOSEGAMEGUARDIANANDWAITFORCLICK)

local gold = gg.prompt({'How much gold does this helicopter order give?'}, nil, {'text'})

gg.refineNumber(gold, gg.TYPE_DWORD)

 

gg.searchNumber(gold, gg.TYPE_DWORD)

("hi")

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

gg.clearResults()

gg.alert("Go to the helicopter and click on an order.")

local gold = gg.prompt({'How much gold does this helicopter order give?'}, nil, {'text'})

gg.searchNumber(hi, gg.TYPE_DWORD)

gg.alert("Delete this order and speed up the next one. Then click the gameguardian icon again.")

--this will close the script and second prompt will not appear until user tap GG icon--
while true do
if gg.isVisible() then
gg.setVisible(false) 
break
end
gg.sleep(100)
end

local gold = gg.prompt({'How much gold does this helicopter order give?'}, nil, {'text'})

gg.refineNumber(gold, gg.TYPE_DWORD)
gg.searchNumber(gold, gg.TYPE_DWORD)

("hi")

 

Link to comment
Share on other sites

26 minutes ago, MonkeySAN said:
gg.clearResults()

gg.alert("Go to the helicopter and click on an order.")

local gold = gg.prompt({'How much gold does this helicopter order give?'}, nil, {'text'})

gg.searchNumber(hi, gg.TYPE_DWORD)

gg.alert("Delete this order and speed up the next one. Then click the gameguardian icon again.")

--this will close the script and second prompt will not appear until user tap GG icon--
while true do
if gg.isVisible() then
gg.setVisible(false) 
break
end
gg.sleep(100)
end

local gold = gg.prompt({'How much gold does this helicopter order give?'}, nil, {'text'})

gg.refineNumber(gold, gg.TYPE_DWORD)
gg.searchNumber(gold, gg.TYPE_DWORD)

("hi")

 

Tysm! So basically, I want to use the command break, or the command sleep?

Link to comment
Share on other sites

Ok, I found it. Basically, what this is doing is waiting until gg is opened. Gameguardian can close and open it, but the user can also. Gameguardian closes, and waits until it's opened.

Here is what I made:

 

function wait_for_action()

gg.setVisible(false) 

while true do

if gg.isVisible() then

break

end

end

end

Link to comment
Share on other sites

@HorridModz

waitingForData = false

function firstPart()
    waitingForData = true
    --do first part here
end

function secondPart()
    waitingForData = false
    --do first part here
end

function homeMenu()
    if waitingForData == true then
        secondPart()
    else
        local menu = gg.choice({"First Part"})
        if menu~= nil then
            if menu == 1 then
                firstPart()
            end
        end
    end
end

while true do
	if gg.isVisible() then
		gg.setVisible(false)
		homeMenu()
	end
	gg.sleep(100)
end

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.