This code is working mostly, but occasionally I'll get an input box with no prompt attached, seemingly more frequently with lower table sizes. Some other functionality isn't working but I'm not too worried about anything else.
Multiplication times tables script Topic is solved
Re: Multiplication times tables script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
MyTable := []
InputBox,Tsize,Choose a number!,How many rows and columns to solve?
col=1
row=1
while col<Tsize
{
myTable[col,row]:= col*row
row++
if (row>Tsize)
{
col++
row=1
}
}
aTable:=[]
col=1
row=1
while col<Tsize
{
aTable[col,row]:= col "x" row "=?"
row++
if (row>Tsize)
{
col++
row=1
}
}
while MyTable!=[] ;this limiting parameter is not working
{
random,one,1,Tsize
random,two,1,Tsize
InputBox, solution, solve this!,% aTable[one][two] ;keep getting inputboxes which reference nothing
if (solution = MyTable[one][two])
{
MsgBox,Nice
}
}
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
MyTable := []
InputBox,Tsize,Choose a number!,How many rows and columns to solve?
col=1
row=1
while col<Tsize
{
myTable[col,row]:= col*row
row++
if (row>Tsize)
{
col++
row=1
}
}
aTable:=[]
col=1
row=1
while col<Tsize
{
aTable[col,row]:= col "x" row "=?"
row++
if (row>Tsize)
{
col++
row=1
}
}
while MyTable!=[] ;this limiting parameter is not working
{
random,one,1,Tsize
random,two,1,Tsize
InputBox, solution, solve this!,% aTable[one][two] ;keep getting inputboxes which reference nothing
if (solution = MyTable[one][two])
{
MsgBox,Nice
}
}
Re: Multiplication times tables script Topic is solved
Code: Select all
while MyTable!=[] ;this limiting parameter is not working
Code: Select all
InputBox, solution, solve this!,% aTable[one][two] ;keep getting inputboxes which reference nothing
MyTable := [[1, 2]] instead of MyTable := [[1, 2], [1, 4]], ie the last row is missing
Re: Multiplication times tables script
Yeah, you were right swag, I just had to increase the size of the Tsize to build out that final row (or change the "<" to "<=" ).
I was trying to find a way to end the script after every equation is solved.
I had these lines under the last MsgBox
I'm not too worried about making this part work for now, just more stuff to play around with, thanks for the suggestions though.
And thanks for helping!
I was trying to find a way to end the script after every equation is solved.
Code: Select all
while MyTable!=[]
I had these lines under the last MsgBox
Code: Select all
MyTable.RemoveAt(one,two)
aTable.RemoveAt(one,two)
And thanks for helping!
Code: Select all
MyTable := []
InputBox,Tsize,Choose a number!,How many rows and columns to solve?
col=1
row=1
while col<Tsize+1
{
myTable[col,row]:= col*row
row++
if (row>Tsize)
{
col++
row=1
}
}
aTable:=[]
col=1
row=1
while col<Tsize+1
{
aTable[col,row]:= col "x" row "=?"
row++
if (row>Tsize)
{
col++
row=1
}
}
while MyTable!=[]
{
random,one,1,Tsize
random,two,1,Tsize
InputBox, solution, solve this!,% aTable[one][two]
if (solution = MyTable[one][two])
{
MsgBox,Nice
}
}
esc::exitApp