Open Side Menu Go to the Top

07-17-2011 , 06:39 PM
loop %whole%
{
temploop := %A_Index% - 1
msgbox %temploop%
loop %temploop%
{
; stuff imo
}
}



So let's assume that whole is like 10, I'd like the message box to say 0,1,2,... 9.

However, it's returning an empty string right now.

I've tried using setformat but I haven't been able to get it right. I've also tried just setting temploop to 0 as the first instruction to try to force it to be an int.
trouble with ahk script Quote
trouble with ahk script
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
trouble with ahk script
07-17-2011 , 07:39 PM
Quote:
Originally Posted by DavidC
loop %whole%
{
temploop := %A_Index% - 1
msgbox %temploop%
loop %temploop%
{
; stuff imo
}
}



So let's assume that whole is like 10, I'd like the message box to say 0,1,2,... 9.

However, it's returning an empty string right now.

I've tried using setformat but I haven't been able to get it right. I've also tried just setting temploop to 0 as the first instruction to try to force it to be an int.
Remove the % From A_index ,Ahk is sometimes confusing
trouble with ahk script Quote
07-17-2011 , 08:18 PM
thanks, yeah I get how the % symbol is used now (i hope), that should be great!
trouble with ahk script Quote
07-19-2011 , 03:44 AM
Reading about functions now, gotta be something wrong with the way I wrote this, but:

Code:
Ballsy(mman,ddave)
{
	if mman = ddave
	{
		msgbox b.
	}
}


; =============================================
; =============================================
; =============================================
; =============================================




man := "Dave"
dave := %man%

if man = dave
{
	msgbox a.
}

Ballsy(%man%,%dave%)
Results in a message box for A but B. I mean, obviously I've just written it wrong but damn.
trouble with ahk script Quote
07-19-2011 , 09:22 AM
Quote:
Originally Posted by DavidC
Reading about functions now, gotta be something wrong with the way I wrote this, but:

Code:
Ballsy(mman,ddave)
{
	if mman = ddave
	{
		msgbox b.
	}
}


; =============================================
; =============================================
; =============================================
; =============================================




man := "Dave"
dave := man

if ( man = dave)
{
	msgbox a.
}

Ballsy(man,dave)
Results in a message box for A but B. I mean, obviously I've just written it wrong but damn.
i changed the not working part to blue
Example using := and =
Name:="your name"
Text:= "My name is" Name ; :=
Text=My name is %Name% ; =

If man = dave ; var man equal text dave
If (man ="dave") ; var man equal text dave


If (man = dave) ; var man equal var dave
trouble with ahk script Quote
07-19-2011 , 03:00 PM
study this page carefully:

http://www.autohotkey.com/docs/Variables.htm

there are two ways of assigning a value to variables, using = and :=
simiarly, there are two ways of comparing values with ifs, using = and ( = )

in both cases, you should get used to the latter of the two and stick to that. future ahk versions will be eliminating the first ways

MaxThread gave you the same hints, but he didnt change the if code inside your function. i think i understand the intent of your code, and it should be written like this:

Code:
Ballsy(mman,ddave)
{
	if (mman = ddave)
	{
		msgbox b.
	}
}


; =============================================


man := "Dave"
dave := man

if (man = dave)
{
	msgbox a.
}

Ballsy(man,dave)
trouble with ahk script Quote
07-19-2011 , 04:26 PM
Thanks guys, I'll check it out.
trouble with ahk script Quote
trouble with ahk script
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
trouble with ahk script

      
m