You are not logged in.

loki

Trainee

  • "loki" started this thread

Posts: 72

Location: Berlin

  • Send private message

1

Saturday, October 2nd 2021, 6:34pm

if condition help "if(scene name CONTAINS STRING xx, action(););"?

Hi all,

I'm curious how something like this can be achieved correctly?

Source code

1
if( scene[get(xml.scene)].name CONTAINS STRING 'xx' , action(); );


With this I could easily call group specific actions without defining variables in each scene.

Thanks for your help!
Max

2

Saturday, October 2nd 2021, 7:26pm

https://krpano.com/docu/actions/#expr.contains

untested but should be :

if( calc( contains(scene[get(xml.scene)].name, 'xx') ) , action(); );

edit: maybe it needs a semicolon after the calc

loki

Trainee

  • "loki" started this thread

Posts: 72

Location: Berlin

  • Send private message

3

Saturday, October 2nd 2021, 7:38pm

Thanks index,

with calc(); and contains() it works. Nice!

Source code

1
2
3
4
5
6
7
8
9
if(
	calc(
		contains(scene[get(xml.scene)].name , 'xx')
	);
,
	trace('scene name contains xx');
,
	trace('scene name does not contain xx');
);



4

Sunday, October 3rd 2021, 9:07pm

Hi,

just as note - a calc() is not necessary there, the if() action already takes an expression as argument.

That means this would be already enough:

Source code

1
if( contains(scene[get(xml.scene)].name , 'xx'), ... );


Best regards,
Klaus