LoadSceneFromScript

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

LoadSceneFromScript // Scriptorium

1  |  

Post by Asem // Oct 15, 2006, 4:19pm

Asem
Total Posts: 255
Hi ya'll doing lol(sorry kinda hyper). Well I wanted to script something that would let me load multiple scenes based on what happens in current scene. Basically the idea is have which ever object be a sensor and thing when an object collides or sets of the sensor it loads to a particular scene. It could usefull for interactive scenes or even regular ones I guess a shortcut to the file->open but when your in the scene. I created a very basic script and scne to try to see some of the concept(even though it doesn't load anything).


When moving the sphere onto the cube it's supposed to system alert. but it doesn't and I'm probably doing something small but I can't really think of what it is.

Contact is an integer.

Post by trueBlue // Oct 15, 2006, 6:07pm

trueBlue
Total Posts: 1761
pic
I think the StreetLampAuto activity would point you in the right direction. It is in Activities/My Activities. Not sure if it would be an issue, but when you change scenes you are asked if you want to change. Might be a conflict there with a Question and a Message.

Post by stan // Oct 16, 2006, 4:02am

stan
Total Posts: 1240
pic
Asem, here is an example of what you asked for based on Norm's '"open browser" widget..import to objects, then drag it into the LE or workspace..click on the sphere..it will open the chains.rsscn without any prompt to save current scene..change scene and path in the script node[called 'open scene' inside ctrl node] hth Gord :cool:

Post by Asem // Oct 16, 2006, 6:21am

Asem
Total Posts: 255
Thanks Stan I take a look at it when I get home! I been thinking of how to go about this for some time technically to split the amount of the scene I have that way it doesn't get bogged down because of my videocard going its to much geometry or to many textures lol.

Post by Asem // Oct 16, 2006, 9:34pm

Asem
Total Posts: 255
Is it possible to have the player viewport re-initialize itself as sometimes when creating widgets that appear in the player view tend to stop appearing? It could actually be pretty usefull in case of the widget failing to appear rather than shut-down or replacing a certain node causing the problem but then again I'm not sure if that is the problem? Thanks Stan and TrueBlue I think I'm starting to get the hang of the widget system and the scripting. Basically I'm going to combine a simple click to scene bitmap that appears by screen coords and when clicked on changes scene(technically I would like to take it further and stream the data in, well, maybe later if possible:)).

Post by Asem // Oct 25, 2006, 11:40pm

Asem
Total Posts: 255
After a little messing with the scripting and examples that you guys gave. I got my auto detect loadscene node to work. One problem though and I find it pretty odd is that if you load a RsScn from the RsScn folder it works fine but creating your own scene then exporting it as .RsScn to use for testing it makes the view load nothing instead of the actual scene.

What is the Difference between the functions LoadScene(str) [<-I use that one] and LoadRsScn(str)?

I've created a very basic scene example though for the moment you're going to have to just select the right directory and file. Test loading a file from the folder with the scene and one that is already created in the ts7 directory RsScenes Library(or something like that).

By the way the extensions are not very consistent(hopefully that is fixed in ts7.5) so you might see .rsscn or .RsScn or .RsScene...

Also is there an auto windows pathfinder/root directory type script like %ROOT% + etc... where root would get the root directory of wherever the scene was loaded?

Make sure Activate is checkmarked and just move any of the object into the yeloo wire frame detector.

Post by trueBlue // Oct 26, 2006, 4:00pm

trueBlue
Total Posts: 1761
pic
Hey Asem:
Do you have the trueSpace7 Data Objects and Script Objects Docs?
Space.GetMainDir() is for trueSpace7 main directory, look at the Labyrinth scripts for this information.
I could not get your scene to work at all. Here is a modified version of your scene that works most of the time. After switching back and forth between scenes it stops working. Why I do not know. Reloading the scene and starting over works the same way. Could be the Timer's setting now that I think about it. May want to set the period in both scenes. Could be that it was activated when I saved both scenes.
I had a thought for a different way to do what you want. Which would be instead of loading a scene, you could load Encapsulated objects and then deleting unwanted objects.
This is a scene library with two scenes:

Post by Asem // Oct 26, 2006, 5:02pm

Asem
Total Posts: 255
Thanks, wasn't sure how to do the main directory thing or if it had one.

That could work also and it would only take a little more time to pull that off which might be a little more beneficial. I ind it wierd that it happens. also I'm not sure if you saw it but there was an override tab to do the test. I'm going to go back to this in the weekend.:)

also I have the only one for the test which you have given me some insight and that maybe I want to approach it another way hopefully I can get it running probably as a scene based version and then do an object based version. I'll check to see what you did.

Can the developers give me some insight on why it this doesn't load the scene sometimes?

Post by trueBlue // Oct 26, 2006, 5:45pm

trueBlue
Total Posts: 1761
pic
Asem: I just talked to somebody about this and when he gets time he is going to post a script which would eliminate the need for a timer. When I first looked at this, I was thinking why would you need a timer? I did not say anything because I was not sure. Look at the SetColor script inside the StreetLampAuto activity for an idea.

Post by Asem // Oct 26, 2006, 11:03pm

Asem
Total Posts: 255
The reason why I use the timer is that the script will not execute when the an object passes through the detector object (automatically). If I don't have it, it will not run unless I were to press start/run.

To explain more
-----------------

the an other object when moved in proximation with the object detector is touched/inside it gives of a value of 1 instead of 0.

now the script will not run own its own without someone having to manually press start.

So hooking a timers controll out with the scripts controll in and making the timer activated will cause a continuous event letting the script constantly check to see if the value is 1 (to change the scene) or 0 (to do nothing).

This lets the user just simply make sure the activate checkbox is checked (which if/[can be] set before save scene then you don't have to worry about it when you load it back up or use it any project) letting the user move any other object into the detector object without the need to place the other object to where it will be detected and having to press start/run manually because it will automatically do it.

It's a good use for making scripts automatic. technically I could make the loader for the toolbar you created automatically load without the need to click load.

probably also when i get the chance I'll add specific object controll also so that the detector object only activates automatically with another but specific object.


I just talked to somebody about this and when he gets time he is going to post a script which would eliminate the need for a timer

Cool trueBlue that would be awsome. One less connection making it a little more productive. :D

Post by trueBlue // Oct 28, 2006, 10:44am

trueBlue
Total Posts: 1761
pic
Yes I understand what you are saying. The only reason I set it up that way was for demonstration purposes.
I have since exchanged the Timer with a Watch Dog Event which works but with the same undependable results. I have been also experimenting with different UpdFreq values. One thing that is dependable which is undesirable, when you go through the trigger and then back out it works every time.
:confused:

Post by Asem // Oct 28, 2006, 8:45pm

Asem
Total Posts: 255
I honestly think it has to do with how ts7 saves its files or how it loads them. maybe a slight glitch or maybe a glitch with my ts saving the exporting correctly (I at least wouldn't expect to see it happening on ts75 since they are updating the libraries to some extent or something). Don't you think its weird to see to different load functions?

Post by Délé // Oct 31, 2006, 3:41pm

Délé
Total Posts: 1374
pic
Hey guys,

trueBlue told me about this scene in truePlay last week. Interesting idea. :)

I can't get the scene to work at all though. Nothing happens. Perhaps I'm doing something wrong. It is supposed to change scenes when the cube gets close to the sensor object right?

I'll upload another scene here. I just swapped out the proximity sensor for the distance script. Then I changed the "change scene" script from a jscript command to a jscript object. I didn't change the code at all though. I think this should allow continues monitoring without the need for a timer to activate the scripts.

However, since the original scene didn't work for me, the new one doesn't either. So I can't really test it. I'll have to play around a bit more and see why it's not working for me. :confused:
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn