You are not logged in.

1

Monday, October 25th 2010, 2:57pm

Timer

I would like to know if there is a way to use a timer in krpano ?
I want for example to play a sound (with the current plugin) after X second where X would be a random value.
Is it something already developed or do I need to build an SWF plugin for that.
Thanks for your reply.

VN2009

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

2

Monday, October 25th 2010, 3:40pm

there is nothing like that available now. but if you know xml well you could use the math operations to generate a random number I know that can be done, then you could insert that into a delaycall() action.

mindlessboss

Professional

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

3

Monday, October 25th 2010, 3:41pm

Hi! see this

timerset(); - http://krpano.com/docu/actions/#timerset
delayedcall(); - http://krpano.com/docu/actions/#delayedcall
and random value already have - http://krpano.com/docu/quickref/
findout random

Regards!

You just need to see documentation and examples....
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

4

Monday, October 25th 2010, 4:02pm

Thanks a lot guys
For the random, I already read the regarding posts.
I will take a look at the others

5

Monday, October 25th 2010, 4:48pm

Sorry but the delayCall which seem to be the most accurate function doesn't work with random
Here is my code :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
<action name="random">
		mul(randomvalue, random, 10);
  	roundval(randomvalue,0);
  	showlog(); 
  	trace('randomvalue=', randomvalue);
  	delayedcall(randomvalue, action(playS1); );
  	trace('randomvalue=', randomvalue);
  </action>
  
  <action name="playS1">
	playsound(s1,sounds/s1.mp3,1);
  </action>

Whatever the random value is the sound starts immediately.

Whereas this code works

Source code

1
2
3
4
5
6
7
8
9
10
11
<action name="random">
		mul(randomvalue, random, 10);
  	roundval(randomvalue,0);
  	showlog(); 
  	trace('randomvalue=', randomvalue);
  	delayedcall(8, action(playS1); );
  </action>
  
  <action name="playS1">
	playsound(s1,sounds/s1.mp3,1);
  </action>

What is going on ?
Thanks

6

Monday, October 25th 2010, 5:36pm


Sorry but the delayCall which seem to be the most accurate function doesn't work with random
...
What is going on ?


try changing

Source code

1
  	delayedcall(randomvalue, action(playS1); );
to

Source code

1
  	delayedcall(get(randomvalue), action(playS1); );


Without the get() you're passing the string value "randomvalue" as the first argument of delayedcall. get() will pass the value of the variable randomvalue.

hope this helps

steve

7

Monday, October 25th 2010, 6:28pm

Thanks a lot, it's working now

Similar threads