It is currently April 24th, 2024, 4:54 am

New support for multiple parameters to SKIN:Bang()

Discuss the use of Lua in Script measures.
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

New support for multiple parameters to SKIN:Bang()

Post by XANCI »

Lua Script: Added support for multiple parameters to SKIN:Bang() to simplify bang arguments:
SKIN:Bang(string bang, string arg1, string arg2, string argN)
SKIN:Bang('!SetOption', 'Meter1', 'FontSize', '15')

Previously, a bang was sent using SKIN:Bang('bang string'). New scripts should use SKIN:Bang('!name', 'arg1', 'arg2', 'argN').
Is this really "simplify" bang arguments?

First check a simple one

Code: Select all

	SKIN:Bang('!SetOption mt1 SolidColor ffffff')
	SKIN:Bang('!SetOption','mt1','SolidColor','ffffff')
not simplified much when compare "','" with " "

Then how about this one?

Code: Select all

	s1='A "B'
	SKIN:Bang('!SetOption mt2 Text \"\"\"'..s1..'\"\"\"')
	SKIN:Bang('!SetOption','mt2','Text',s1)
there is a double quote in the string so if I use a complete !Bang I have to use triple-double quotes around parameter, but with the new feature this one is much simpler

Am I getting it?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: New support for multiple parameters to SKIN:Bang()

Post by smurfier »

Here's one to think about:

SKIN:Bang('!SetOption '..Meter[i]..' Text """'..Var..Text[i]..'"""')

becomes
SKIN:Bang('!SetOption',Meter[i],'Text',Var..Text[i])

It eliminates the need for both magic quotes and concatenation of multiple variables and conditions into one long string.

So, yes you are getting it.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: New support for multiple parameters to SKIN:Bang()

Post by Mordasius »

Should

SKIN:Bang('!SetOption,Meter[i],'Text',Var..Text[i])

be

SKIN:Bang('!SetOption',Meter[i],'Text',Var..Text[i])

or is that ' after '!SetOption not required with the new SKIN:Bang()?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: New support for multiple parameters to SKIN:Bang()

Post by smurfier »

Sorry, that was a typo.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .