Only numbers for "scene=" not allowed, transform a scene in only number in a variable

• Hi everybody, time to go to sleep I guess, I've got to be at work at 8 o'clock ^^

But just a little question before that ;)

If I trace a scene name called "scene_001", log shows "scene_001"

"_001" shows "_001"

But if you use only numbers, from 0 to 9 instead of showing 0 to 9 it's n0, n1, etc. Is it normal ?

0000, 1111 throws "NULL" and don't charge anything. I guess there's a reason for all that but I don't know which.

Is it possible to name scene only with numbers ? If yes, are they limitations and things not to do ? If it's not possible how can I transform it in a variable to only have numbers for result ? I thought parsefloat could help me to do it when I've read the description in the doc, but it doesn't work as expected. If I put "11a1" it returns only "11". Perhaps I don't use it the right way.

Have a nice day everybody :)

• Each name needs to begin with an alphabetic character!
• That means using a number as name is not allowed!
• Thanks a lot ! So sad :(

How could I manage to "clean" the name (lets say "_001") from his "_" to use it as a variable ? I really thought parsefloat was supposed to do it and still hope I did something wrong with. Because if it cannot be done with that I have no idea how I could do. I'm afraid it parse numbers until it finds something else then stop, but I still hope it can be used ^^

As I explained,

Code
``````    <action name="tracescn" scope="global">
calc(parse, parsefloat(11a1));
trace(parse);
</action>``````

Throws me "11". "111a1" -> "111", etc.

• Official Post

E.g. for names like 'scene_001':

Code
``parse = parseint(substr(scenename,6))``

The substr(var, 6) skips the first 6 characters 'scene_' and parseint convert the remaining string to an Integer.

Alternatively also such would work - this will first search for the '_' character and then use the string after that:

Code
``parse = parseint(substr(scenename,indexof(scenename,'_')+1))``

Or even more alternatively - if you're more familiar with Javascript code, directly using Javascript code would be also possible (but the actual code would be very similar).

• Guys you're so kind! Thanks a lot, I'm gonna try this as soon as I will be back at home :)

• Hi :) Back at home but a bit depressed because I feel really dumb :/I can't manage to make this code work, I tought I just had to put it in an <action> but I guess I'm missing something. Just pasting this part in an action doesn't work so I thought I had to "calc" it. I tried first

Code
``````   <action name="tracescn" scope="global">
parse = parseint(substr(scenename,6));
trace(parse); (or tried "tracescn" too)
</action>``````

Then with calc

Code
``````    <action name="tracescn" scope="global">
calc(parse = parseint(substr(scenename,6)));
trace(parse);
</action>``````

Or "xml.scene" instead of "scenename" but it doesn't work either. I also tried exotic (and probably stupids) things.

Anyway, sure I have to read the doc again and to concentrate better now I start to undersand better (that's already great to see all I learned passed days) but if you could give me a clu on what 'mI doing wrong that would be great. Sorry, I promise I tried a lot of things and read since my first try but I don't understand.

Sorry for the english too, I'm not sure all the syntax is correct but the advantage in that case is that I don"t get parsing errors !!

EDIT : Oh, I forgot the next question I'll probably have to ask, I don't want an integer as I need a decimal for my timevideo in the video. Before I saw I didn't even manage to use your code I tried the same code without "parseint". I would search alone but as I'm not able to work it I thought it could be interesting to mention I don't want "parseint" ;)

EDIT 2 : I also tried

Code
`````` <action name="tracescn" scope="local">
set(tracescn=txtreplace(xml.scene, scene_, 0);
trace(tracescn);
</action>``````

The same with "scenename" instead of xml.scene (I try this because it's the only one I managed to trace, but perhaps it's an error to try to test all with trace. Same with "global" and "local" for scope...

Edited 3 times, last by gn0o0b (January 11, 2024 at 11:59 PM).

• gn0o0bJanuary 12, 2024 at 12:02 AM

Changed the title of the thread from “[vtour] Limitations in scene names ?” to “Only numbers for "scene=" not allowed, transform a scene in only number in a variable”.
• use calc() the same way as you did already.

parseint/textreplace/substr are usable in expressions only... see here

calc() is used to evaluate expressions

--->

calc(parse, parseint(substr(scenename,6)));

calc(tracescn, txtreplace(xml.scene, "scene_", ""));

• Thanks for your answers:) Tresure hunt can continue ! You can't imagine all the stuff I've learned, I'll be so happy the day I'll become a bit more skilled.

EDIT 1 : Great ! It works, I now have to figure out why it only returns the video and never the scene_00x but I have ideas of what could be the problem, I'm not stuck anymore, thank you.

EDIT 2 : INFO:035

Here I am !!! Thanks so much. Will I manage to be smart enough to pass thrue the next step without help ? ^^

EDIT 3 : INFO: 013 INFO: 0.4377104377104377

So happy ! At least one step I didn't have to ask for help. But I'm wondering if I'm not finally quite sad, I hope I misunderstood but when I try to set a variable in seek it seems it's not possible. https://krpano.com/plugins/videoplayer/#seek

Code
``````Parameters:

time
The intended playback position.
Either in seconds.
Or as percent value (0% - 100%).``````

I see there's a "start position" too, but I don't even manage to make it work only with "1.0" or "1" as parameter so no need to try a variable ^^ starttime="1.0" in the plugin name="video" doesn't do anything, but perhaps it's not a number in seconds I shall put, I didn't find the info.

If it's not possible to throw a var in seek() or starttime() am I totally stuck ? Does somebody have an idea ? I have a var with the value in seconds I want the video to start at this value, but how could I tell it to the player if I can't with seek or starttime ? If not possible in krpano directly could it be possible with javascript ?

Edited 6 times, last by gn0o0b (January 12, 2024 at 1:53 AM).

• For future readers, I finally managed to do it, I'm not sure that was the smarter way but I'm really happy it was finally possible. I created a new action with calc "seek(" + variable + ")" then when calling the action I have the seek set at the good value. Lots of reading and thinking before I had this idea yesterday in my bed.

Thanks a lot klaus.krpano and indexofrefraction without your help I wouldn't have manage anything and wouldn't have learned so much. The journey is still quite long and I'm not sure it will work, but I think the hardest is behind now. I hope I won't face new problems I didn't think about... time will tell.

Have a nice week-end everybody :)

• Official Post

If it's not possible to throw a var in seek() or starttime() am I totally stuck ? Does somebody have an idea ? I have a var with the value in seconds I want the video to start at this value, but how could I tell it to the player if I can't with seek or starttime ? If not possible in krpano directly could it be possible with javascript ?

Great that you managed it, but additionally here also as reference the link to the documentation about passing parameters:

• Thank you, Klaus, if think I understand better now, I've read all mutliples times but there is a lot of infos in the doc.

As I understand there was in fact a smarter way ^^ I'm gonna try to make something cleaner with you advises :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!