Page 1 of 1

do When

Posted: 26 Jul 2019, 15:53
by SSpeed
do when

the When command

Code: Select all

when the_game_is_closed(), 24000
	exitapp
Faster, easier, more elegant than setting timers.

Code: Select all

when a_raider_is_detected()
{	fire_a_warning_shot()
	notify_the_user()
	cooldown when not a_raider_is_detected()
}
(the above code is equivalent to the code below)


and finally, le coup de grace.

Code: Select all

while internet_browser.active, 10000
when (flash_player.active and site="YouTube"), 2000
{	adjust_settings_macro()
	cooldown when not (flash_player.active and site="YouTube")
}
(which is equivalent to)
.
Glad to share :)



Is it to be implemented?
perhaps Cooldown should be simpler, like making it function without a need for parameters?
edit: on second thought, I think cooldown should be implicit.

Re: do When

Posted: 28 Jul 2019, 04:40
by nnnik
It could be implemented.
I also think that a syntax that handles events (or can be used to create value polling more easily).
Nonetheless the design you provided is probably very clunky and limited.
The second parameter seems very strange and we might be better off putting it into a function which could provide a simple polling mechanism.

There are also a lot of things that are not clear from this example.

Re: do When

Posted: 08 Sep 2019, 04:23
by Delta Pythagorean
Wouldn't this count as both an OnMessage and an #If?

Re: do When

Posted: 14 Sep 2019, 17:42
by SSpeed

Code: Select all

When WinActive(game.window) {
	Run(game.script)
	When !WinActive(game.window)
		WinClose(game.script)
}

Code: Select all

When WinExist(chrome.window) {
	Msgbox you've opened chrome
	When !WinExist(chrome.window)
		Msgbox you've closed chrome
}
I think I like this version more than the OP.