Multiplication times tables script Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
decs
Posts: 3
Joined: 21 Oct 2018, 05:10

Multiplication times tables script

21 Oct 2018, 05:23

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.
TimesTable.ahk
(930 Bytes) Downloaded 27 times
TimeTable.txt
(930 Bytes) Downloaded 24 times
decs
Posts: 3
Joined: 21 Oct 2018, 05:10

Re: Multiplication times tables script

21 Oct 2018, 05:24

#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
}
}
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Multiplication times tables script  Topic is solved

21 Oct 2018, 08:06

Code: Select all

while MyTable!=[] ;this limiting parameter is not working
i dont understand the semantics behind what uve tried doing here. if u wanna check if MyTable is an object use IsObject(). if u wanna check if its empty use .Count()

Code: Select all

InputBox, solution, solve this!,% aTable[one][two] ;keep getting inputboxes which reference nothing
ull keep getting nothing, whenever one and two u get from Random are equal to Tsize. theres an error in the array building logic, resulting in malformed arrays, ex for 2x2 MyTable looks like this:
MyTable := [[1, 2]] instead of MyTable := [[1, 2], [1, 4]], ie the last row is missing
decs
Posts: 3
Joined: 21 Oct 2018, 05:10

Re: Multiplication times tables script

21 Oct 2018, 22:49

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.

Code: Select all

while MyTable!=[]



I had these lines under the last MsgBox

Code: Select all

MyTable.RemoveAt(one,two)
aTable.RemoveAt(one,two)
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!

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

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jdfnnl, Joey5 and 347 guests