[SOLVED] Using If functions to check a variable Topic is solved

A forum dedicated to George scripting questions
Post Reply
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

[SOLVED] Using If functions to check a variable

Post by schwarzgrau »

I try to write a script, which checks if a stencil is active, but it seems I'm handling the request the wrong way.

Code: Select all

//======= GET ID =======//

tv_LayerGetID 0
Lid = Result 				

tv_layerstencil Lid
PARSE result Lid STon STstyle

IF (STon == "on")
	PRINT "It is on"
ELSE
	PRINT "It is off"
END
If I PRINT STon I get "on" or "off", but I can't get the if function work, no matter if I write IF (STon == "on") or IF (STon == on)
Last edited by schwarzgrau on 07 Oct 2016, 12:18, edited 1 time in total.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Svengali
Posts: 1553
Joined: 28 Dec 2006, 10:08

Re: Using If functions to check a variable

Post by Svengali »

when testing a string you need to use the compare command:

try:
IF CMP(STon, "on")==1
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Using If functions to check a variable

Post by schwarzgrau »

Thank you a lot, now it works.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
User avatar
ini
Posts: 91
Joined: 14 Aug 2015, 17:47
Contact:

Re: Using If functions to check a variable

Post by ini »

IF CMP(Ston, "on")
-
ELSE
-
END

It works too.
Last edited by ini on 26 Jul 2016, 14:49, edited 2 times in total.
e-mail : ini@7ini.com twitter : @Ain_is_
-----------------------------------------------------
TVPaint 11 PRO STD (11.7.0 - 64bits) on
AMD Ryzen9 5950x, 3080 &2080ti, 128GB ram, Windows10, Cintiq 27 Pro (DTH-271)

TVPaint 11 PRO WIBU (11.5.1 - 64bits) on
Cintiq Mobile Studio Pro 13 (DTH-W1321H)
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Using If functions to check a variable

Post by schwarzgrau »

Sorry I don't understand what you said. It wanted to say, that it works, after using the way Svengali described.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Post Reply