This variable has not been assigned a value after running some other scripts.

Get help with using AutoHotkey and its commands and hotkeys
kilpsz
Posts: 12
Joined: 10 Jul 2017, 23:02

This variable has not been assigned a value after running some other scripts.

21 Jul 2018, 02:11

Code: Select all

SC029::Suspend, Toggle

#IfWinActive Path of Exile
#SingleInstance force
#NoEnv  
#Warn  
#Persistent 
#MaxThreadsPerHotkey 2

SetTitleMatchMode 3
SendMode Input  
CoordMode, Mouse, Client
Thread, interrupt, 0

global Speed=1
global CellWith=53
global InventoryX=1297
global InventoryY=616


RandomSleep(min,max){
	Random, r, %min%, %max%
	r:=floor(r/Speed)
	Sleep %r%
	return
}



$1::CtrlClick13(InventoryX,InventoryY)

 
CtrlClick13(iX,iY){
	BlockInput On
	RandomSleep(5,40)
	; iX, iY -> Get Pos of top left inventory cell
	if iX = -1 
		MouseGetPos iX,iY
	
	delta := CellWith			
	x := ix
	y := iy					
	
	Loop 3 { ;			
		Loop 5 { 			
			Mousemove ,%x%, %y%
			RandomSleep(5,20)
			send ^{Click}
			RandomSleep(5,20)
			
			y += delta			
		}
		y := iy
		x += delta				
	}
		
	BlockInput Off
 }
 

Even when no other script is running(even restarted pc) i still get the same error, i'm pretty sure it started happening when i ran some other scripts.
lexikos
Posts: 6176
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: This variable has not been assigned a value after running some other scripts.

21 Jul 2018, 02:37

That is because, as it says, the variable has not been assigned a value. It would have started when you added the SC029 hotkey at the top of the script. See the FAQ: Why do some lines in my script never execute?
kilpsz
Posts: 12
Joined: 10 Jul 2017, 23:02

Re: This variable has not been assigned a value after running some other scripts.

21 Jul 2018, 03:10

So how do i add "SC029::Suspend, Toggle" to this?
User avatar
gregster
Posts: 1394
Joined: 30 Sep 2013, 06:48

Re: This variable has not been assigned a value after running some other scripts.

21 Jul 2018, 07:32

kilpsz wrote:So how do i add "SC029::Suspend, Toggle" to this?
https://autohotkey.com/docs/FAQ.htm#autoexec wrote:Any lines you want to execute immediately when the script starts should appear at the top of the script, prior to the first hotkey...
SC029::Suspend, Toggle is the first hotkey... so what about moving it down in the code - at least to the end of the auto-execute section?
kilpsz
Posts: 12
Joined: 10 Jul 2017, 23:02

Re: This variable has not been assigned a value after running some other scripts.

22 Jul 2018, 06:48

I have no idea how to code so i pretty much edited it to my taste so i have no idea where to move it, i tried to move it pretty much everywhere and it'd either give errors or it'd only suspend but not toggle(wouldnt turn back on), i don't what to do.

Code: Select all

 

#IfWinActive Path of Exile
#SingleInstance force
#NoEnv  
#Warn  
#Persistent 
#MaxThreadsPerHotkey 2

SetTitleMatchMode 3
SendMode Input  
CoordMode, Mouse, Client
Thread, interrupt, 0

global Speed=1
global CellWith=53
global InventoryX=1297
global InventoryY=616


SC029::Suspend, Toggle


$r::CtrlClickx(InventoryX,InventoryY)

RandomSleep(min,max){
	Random, r, %min%, %max%
	r:=floor(r/Speed)
	Sleep %r%
	return
}


CtrlClickx(iX,iY){
	BlockInput On
	RandomSleep(5,40)
	; iX, iY -> Get Pos of top left inventory cell
	if iX = -1 
		MouseGetPos iX,iY
	
	delta := CellWith			; delta = 53
	x := ix
	y := iy					
	
	Loop 12 { ;			; Loops iColumn as many times as called
		Loop 5 { 			; Loops iRow as many times as called
			Mousemove ,%x%, %y%
			RandomSleep(5,20)
			send ^{Click}
			RandomSleep(5,20)
			
			y += delta			; Moves 53 to bottom
		}
		y := iy
		x += delta				; Moves 53 to right
	}
		
	BlockInput Off
 }
 
 


Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], paik1002, TXShooter and 29 guests