How do you duplicate scripts?

Hello! My question is how to duplicate long backstage scripts in gamesalad so I don't have to rewrite it over and over for my game.

Best Answer

  • Braydon_SFXBraydon_SFX Posts: 9,028
    Accepted Answer

    You can create 'custom' behaviors after you've set them up. Simply select (click) a rule, behavior or stack of logic. It should highlight in blue. Then drag and drop that selected bunch to the Behavior Library in the bottom left. This will add that stack to the 'custom' tab. You can then go into different actors and drag that behavior into the logic stack as you normally would.

    Does that help?

Answers

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,028
    edited December 2014

    Hello @Discodude16‌ - good question.

    One way is to create a game attribute (boolean type, or integer) and set it to false or 0.
    When you want to execute that block of code, change the game attribute to true ( or 1, if you created an integer). Then, you'll have a rule somewhere that says:

    -Rule: When game.attribute is true
    --Execute code
    

    After the code has executed, make sure to set the game attribute back to false or 0 so it can be triggered again. This usually works well in a RoundRules actor; an actor that I use to keep all of my major logic (change scenes, determine game over, etc).

  • Discodude16Discodude16 Member Posts: 5

    That was sort of what I asked. I am making a game, and I have all of the attributes, but the problem is that the script is long and I have to rewrite it for every level and other actors who should run the same script. I calculated it, and found out I would have to write the script 45 times, which I don't want to do.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,926

    Can you explain why you have to rewrite the script? There are often ways to simplify complex rules. Are you needing different attributes for each actor or each level? Tables can help with that, for example. If we know more about the specifics of what you are doing, we can suggest things that might help.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Discodude16Discodude16 Member Posts: 5

    That Worked! Thanks a lot for the help! :D

Sign In or Register to comment.