It is currently March 28th, 2024, 11:34 pm

Way to simulate inputs?

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

Way to simulate inputs?

Post by LGP123 »

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: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Way to simulate inputs?

Post by balala »

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: 826
Joined: November 20th, 2012, 11:58 pm

Re: Way to simulate inputs?

Post by FreeRaider »

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: 60
Joined: November 5th, 2016, 12:15 pm

Re: Way to simulate inputs?

Post by LGP123 »