License from €75
DE EN FR ES IT CZ

Change to previous scene

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 12 years ago
    Is there a LUA script, or any other method, for going back to the previous scene?

    Thanks in advance!
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.

    Get 15 % off Try it for free
  3. · 12 years ago
    You mean to change back from menu to current scene the playable character is on?

    If that's what you mean then just use the change to scene of character action part & select current character from the drop down list.
  4. · 12 years ago
    Thank you AFRL.

    However, what I actually meant was to switch back to the previous scene from whichever scene you happen to be in (not from the menu, that is). The other adventure game engines I've tried have had this function, and I've grown used to it.

    For example, I usually create a specific scene for each inventory item, which is displayed when the player examines the item. Since examining the items can be done from practically every scene, it is important that the player can go back to the scene that he or she was in before the item was examined.
  5. · 12 years ago
    Ah ok got you.

    Here you go.

    1. create a value (anywhere you like) & name it: previous_scene.

    2. now add the script below to the script section of the editor.
    function saveScene()
     Values["previous_scene"].String = game.CurrentScene:getName()
    end
    
    function restoreScene()
     game.CurrentScene = Scenes[Values["previous_scene"]]
    end
    


    3. to save scene add an execute a script action part just before changing to new scene containing...
    saveScene()
    


    4. to restore scene add an execute a script action part containing...
    restoreScene()
    


    This tutorial / code is written off the top of my head, so I can't guarantee it will work.
  6. · 12 years ago
    Thank you very much. I'm afraid that I'm totally new at this scripting thing. How are the scripts supposed to look like exactly?

    In your step 3, what is supposed to happen is a scene change, executed by a right click (plus the saveScene command of course).

    Step 4 is supposed to simply restore the previous scene, executed by a left click.

    Sorry for being so ignorant, but I can't find any information on how to script a simple scene change.
  7. · 12 years ago
    Let's see...

    2. script tab > create a new script & copy/paste the script I provided.

    3. just before you execute your scene change (with one of the scene change action parts - not scripting), create an execute a script action part & add what I mentioned in step 3.

    4. create an execute a script action part containing what I mentioned in step 4, in the place, button or whatever it is that triggers scene back.

    In theory it should work correctly. Why is it that you can't manually determine which scene to go back to? More or less the same amount of work involved either way.
  8. · 12 years ago
    Yes! It works! Thanks a million!

    Why I can't manually determine which scene to go back to? I'll try to explain why:

    My games are made up entirely by photographs. My last game contained over 1,900 scenes. My next game, for which I contemplate using Visionaire, will probably be just as big. Each inventory item can be examined in close up, which leads to a new scene (there may be a better way to this with Visionaire, but that's the way I've made it this far). Each inventory item can be examined from virtually any of these 1,900 scenes.

    So, upon exiting the scenes for the close up of the various inventory items, there as to be a way to go back to the scene which the player was in prior to changing to the scene for the close up.
  9. · 12 years ago
    Ok dokie. smile

    VS was really made with classical third person point & click games in mind, which is why I assume there is no previous scene action, function or field in the data structure.

    Can't complain really I suppose... The script I wrote was a quick & short workaround to the lack of a pre-made action / function.
  10. · 12 years ago
    I'm using The Wintermute Engine at the moment, which was also made with third person games in mind. With Wintermute, as with Visionaire, there are features that aren't especially suitable for first person games, like connecting this and that to a "fictional" character.

    Still, both Wintermute and (what I've seen this far of) Visionaire are superior to the engines made with first person games in mind.

    What I lack with Wintermute is the ability to scale down the game resolution to the user's screen

    Thanks again for your help!
  11. · 12 years ago
    Really? I thought wintermute also had automatic scaling? Then again I've only played one or two games made in wintermute & that was a fair while back.
  12. · 12 years ago
    Wintermute scales up lower resolutions to the user's desktop resolution perfectly, but can not scale down.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?