GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

Answers

  • Braydon_SFXBraydon_SFX Posts: 8,966Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee
    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 Posts: 5Member

    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 Posts: 11,845Member, Sous Chef, PRO, Senior Sous-Chef

    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 Posts: 5Member

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

Sign In or Register to comment.