You are not logged in.

bg360

Trainee

  • "bg360" started this thread

Posts: 120

Location: Bulgaria

  • Send private message

1

Wednesday, May 26th 2010, 11:26am

if/else for beginners

Hello,
I'd like to switch some plugins in my general XML skin file, but in certain panos they miss. I want to switch PLUGIN, but only if it exists. In other way it will return me error that it's missing. Is there documentation how can I use IF/ELSE ?

Thanx!

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Wednesday, May 26th 2010, 12:38pm

Hi bg360,

Quoted

Is there documentation how can I use IF/ELSE ?
Krpano 1.0.8 beta 4 IF/ELSE

Have a look here for a little explanation.

Also, even if it is not an if/else doc, you can find some example and explanation from Pinsane *thumbup* in his advanced tutorial:
A Tutorial on Krpano Action Arguments (pt 1)

SAlut.

This post has been edited 1 times, last edit by "michel" (May 26th 2010, 12:55pm)


bg360

Trainee

  • "bg360" started this thread

Posts: 120

Location: Bulgaria

  • Send private message

3

Wednesday, May 26th 2010, 2:02pm

Thank you very much, michel !!! *thumbsup*

bg360

Trainee

  • "bg360" started this thread

Posts: 120

Location: Bulgaria

  • Send private message

4

Wednesday, May 26th 2010, 2:51pm

Hm, I thought that it will return me error if I try to tween or hide some non-existing plugin, but nothing happens. In this case may be I don't need if/else conditions. Anyway, how to tell "if this plugin exists" ?

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

5

Wednesday, May 26th 2010, 3:36pm

Hi bg360,

Perhaps something like:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<krpano version="1.0.8" onstart="showlog(); plugin_exists(logo); plugin_exists(no_plugin)" >

	<preview type="grid(cube, 20, 20, 200, 0x4D6199, 0x94D6FF, 0x000000)" details="12" />

	<plugin name="logo"/>

	<action name="plugin_exists">
		if(plugin[%1] !== null,
			trace(----plugin %1 exist----);
			trace('plugin[%1] = ',get(plugin[%1]))
			,
			trace(--plugin %1 does not exist--);
			trace('plugin[%1] = ',get(plugin[%1]))
			);
	</action>
	
</krpano>


Hope this help...

SAlut.

bg360

Trainee

  • "bg360" started this thread

Posts: 120

Location: Bulgaria

  • Send private message

6

Wednesday, May 26th 2010, 6:44pm

Thanx, I'll give a try soon.

bg360

Trainee

  • "bg360" started this thread

Posts: 120

Location: Bulgaria

  • Send private message

7

Wednesday, May 26th 2010, 8:32pm

I made this simple check:

1. Plugin "something" exists:

Source code

1
2
3
 <action name="check">
    if(plugin[something] !== null, showtext(Something is here, infostyle););
</action>

Text "Something is here" is showing

Source code

1
2
3
<action name="check">
    if(plugin[something] == null, showtext(Something is here, infostyle););
</action>

Text "Something is here" is not showing


2. Plugin "something" doesn't exist:

Source code

1
2
3
<action name="check">
    if(plugin[something] !== null, showtext(Something is here, infostyle););
</action>

Text "Something is here" is not showing

Source code

1
2
3
<action name="check">
    if(plugin[something] == null, showtext(Something is here, infostyle););
</action>

Text "Something is here" is not showing


I suppose that I don't have to use plugin[something] == null , but something else...

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

8

Wednesday, May 26th 2010, 9:04pm

Hi bg360,

You have to use ===
The !== and === are strict operators...

More info here .

SAlut.

bg360

Trainee

  • "bg360" started this thread

Posts: 120

Location: Bulgaria

  • Send private message

9

Wednesday, May 26th 2010, 9:50pm

Michel,
thank you for your help! It was very kind of you to answer me all day long *thumbup*
Now it works! And I learned very important things.

Cheers!

10

Thursday, May 27th 2010, 4:54pm

Dear Diary,
Today I learned about the heretofore undocumented
showlog() command. How in the heck does Michel figure this stuff out???

Nice explanation and example Michel. Thanks for the new bit of knowledge!

steve

11

Thursday, May 27th 2010, 5:04pm

There was once a time when I thought "Michel" was just a pseudonym that Klaus used to visit the board anonymously. *whistling*

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

12

Friday, May 28th 2010, 10:38am

Hi,
There was once a time when I thought "Michel" was just a pseudonym that Klaus used to visit the board anonymously. *whistling*
*g* *g* *squint* It seems that there are some ' Klaus pseudonyms ' out there ;-) .
Surely, Jarredja is one of them, always ready to lend a hand so kindly and accurately *thumbup* .
In fact, I believe that the very first one was Graydon... His helping, his accurate explanations, his needs to go more faraway has helped many of us to understand better how great is Krpano *thumbup* .
And the last one in date, with his minted newly 'first star' (the more valuable 'first star' ever minted), Pinsane *thumbup* ...
Of course there are many more pseudonyms out there... To all of them many thanks to spend your time making to this forum so active and valuable *smile* ...
Dear Diary,
Today I learned about the heretofore undocumented
showlog() command. How in the heck does Michel figure this stuff out???
*g* I has knew about the showlog() action because it is used inside the event example from Klaus ;-) ...
A little note about the event example:
This example points out a thing that is not obvious "a priori"... The first event that is triggered is the onresize event. (even if there is "no real" onresize action from the user)

SAlut.

13

Saturday, May 29th 2010, 5:37pm

There was once a time when I thought "Michel" was just a pseudonym that Klaus used to visit the board anonymously. *whistling*


Perhaps you're true Jarredja *thumbsup*

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

14

Saturday, June 19th 2010, 6:53pm

can i do like

if (a specific pano is loaded == true , then; , else?

or so?

Thanx

Tuur *thumbsup* *thumbsup*

Similar threads