Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Mittwoch, 26. Mai 2010, 11:26

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!

2

Mittwoch, 26. Mai 2010, 12:38

Hi bg360,

Zitat

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.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »michel« (26. Mai 2010, 12:55)


3

Mittwoch, 26. Mai 2010, 14:02

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

4

Mittwoch, 26. Mai 2010, 14:51

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" ?

5

Mittwoch, 26. Mai 2010, 15:36

Hi bg360,

Perhaps something like:

Quellcode

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.

6

Mittwoch, 26. Mai 2010, 18:44

Thanx, I'll give a try soon.

7

Mittwoch, 26. Mai 2010, 20:32

I made this simple check:

1. Plugin "something" exists:

Quellcode

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

Text "Something is here" is showing

Quellcode

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:

Quellcode

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

Text "Something is here" is not showing

Quellcode

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...

8

Mittwoch, 26. Mai 2010, 21:04

Hi bg360,

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

More info here .

SAlut.

9

Mittwoch, 26. Mai 2010, 21:50

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

Donnerstag, 27. Mai 2010, 16:54

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

Donnerstag, 27. Mai 2010, 17:04

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

12

Freitag, 28. Mai 2010, 10:38

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

Samstag, 29. Mai 2010, 17:37

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

14

Samstag, 19. Juni 2010, 18:53

can i do like

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

or so?

Thanx

Tuur *thumbsup* *thumbsup*