ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Script to reload scene
person icon
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


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

person icon
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

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

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

Okay thanks


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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