Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Script to reload scene

lucas007
Registered User
Quote
2024-06-22 19:54:24

Hi
I want to know if there are a script that can reload a scene like the script
ccbSwitchToScene



okeoke
Registered User
Quote
2024-06-22 20:06:29

There is an built-in action called "Restart a scene" under "Cameras and scenes". You can pass parameter of type action to your behavior.
Header:
<behavior jsname="behavior_Test" description="Test">
<property name="actionToCall" type="action" default="" />
</behavior>

You can then invoke this action from the code:
ccbInvokeAction(this.actionToCall, this)

Finally, as you put the behavior/action in-game, add "restart a scene" action to actionToCall parameter.

If you're using js file that you put along the .exe there is no way to do that.


lucas007
Registered User
Quote
2024-06-23 11:16:05

Thanks for your help.
But I want to create action that allow to go to the last active scene. For that before exit the last scene I save a variable named last scene and load it like that.
 var scene = ccbGetCopperCubeVariable(this.lastscene)
ccbSwitchToScene("scene")


To avoid many repetition of if...if else....else


okeoke
Registered User
Quote
2024-06-23 14:10:28

Well, you can reset all scenes every time, and use a single action for that, if it works for you. Or you can also use switch statement instead of multiple if else for better readability.


lucas007
Registered User
Quote
2024-06-23 15:49:44

Okay thanks


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact