It is currently September 16th, 2019, 11:26 pm

Way to simulate inputs?

Discuss the use of Lua in Script measures.
User avatar
LGP123
Posts: 57
Joined: November 5th, 2016, 12:15 pm

Way to simulate inputs?

LGP123 » November 29th, 2016, 9:09 pm

I just wanted to know if there were ways to simulate inputs (from keyboard) or maybe a way to insert any character a bit like with alt code but using luascript.

Edit: I found that there was a way with santa_ryan's control suit :). But maybe you guys know other ways ?
User avatar
balala
Rainmeter Sage
Posts: 8618
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Way to simulate inputs?

balala » November 29th, 2016, 10:15 pm

I'm not sure what "santa_ryan's control suit" represents, but the following function can do what you asked:

Code: Select all

function makeString(l)
	if l < 1 then return nil end -- Check for l < 1
	local s = "" -- Start string
	for i = 1, l do
		s = s .. string.char(math.random(32, 126)) -- Generate random number from 32 to 126, turn it into character and add to string
	end
	return s -- Return string
end

function Update()
	SKIN:Bang('!SetVariable', 'Rand', makeString(1))
end
This code returns into the Rand variable of your skin, a randomly chosen char.
User avatar
FreeRaider
Posts: 786
Joined: November 20th, 2012, 11:58 pm

Re: Way to simulate inputs?

FreeRaider » November 30th, 2016, 9:45 am

LGP123 wrote:I just wanted to know if there were ways to simulate inputs (from keyboard) or maybe a way to insert any character a bit like with alt code but using luascript.

Edit: I found that there was a way with santa_ryan's control suit :). But maybe you guys know other ways ?
Can you indicate the skin you found, so as to allow others to have already a solution?
User avatar
LGP123
Posts: 57
Joined: November 5th, 2016, 12:15 pm

Re: Way to simulate inputs?

LGP123 » November 30th, 2016, 10:22 am