Plazma Burst 2 Map Editor Manual
Map Editor Manual v.5.7.0
Map Editor Manual v.5.7.0
  • Map Editor Manual v.5.7.0
  • Changelogs
  • Credits / Special thanks
  • Plazma Burst 2 Official Website
  • Laserguide's Map mapping Tools
  • [Old version] pdf takeaway edition
  • ALE Improvements
  • πŸ—ΊοΈThe Surface of the level editor
    • Old level editor
    • New level editor
    • Map Edit Page
  • πŸ› οΈThe tools
    • Free Edit tool
      • The Shortcuts
    • Add Wall
    • Add Movable
    • Add Region
    • Add Background
    • Add Pushing area
    • Add Water
    • Add Player
    • Add Actor (enemy)
    • Add Vehicle
    • Add Decoration
    • Add Weapon
    • Add Lamp
    • Add Barrel
    • Add Trigger
    • Add Timer
    • Add Engine Mark
    • Scale Selection Tool
    • Add Song
  • πŸͺ‘Tables of Level Editor
    • Character Data Table
    • Character Skin Color Table
    • Trigger Action Table
      • Movable
        • Basic Movable Tutorial
      • Region
      • Vehicle
      • Character
      • Gravity
      • Scenario
        • Tutorial 9 & 50
      • Gun
      • Barrel
      • Trigger
      • Timer
      • Decoration
        • Blending Mode
      • Gravitator area field
      • Gameplay
      • Sound
      • Interface
      • Light
      • Trigger execution
      • Var
        • Inventory Info Tutorial
        • Synchronization of variables
        • Key binding in multiplayer
      • Session vars
      • URL
        • URL Request Tutorial
      • AI
      • Environment
      • Text-to-speech
      • Map preview
      • Experience
      • Array
        • What is array?
        • Matrix Coloring System
      • Graphics
      • Water
      • Miscellaneous
    • Engine Mark Table
      • Sky Code Table
    • Sound Library Table
    • Newer Weaponry Data
      • Weaponry Data
    • Projectiles Model Table
    • Text-to-speech Voice Table
    • Application Table
  • πŸ›tables of debug
    • Cheat Codes
    • Error Codes Identification
  • πŸ”«Secret Weaponry
    • Campaign Maps
    • Alternate method to add Water UID
    • "Fake" Collision
    • Secret Theme "4"
    • More Accurate Snipping
      • History of contributions.
    • Custom Image in Theme Purple/Green
    • Check map
    • Phsc's image import to map source
    • XML Output in Map Editor
    • createColorMatrix Script
  • β˜‘οΈApproval-Military
    • Map Approval Requirements
    • Custom Decoration Guidelines
  • πŸ§˜β€β™€οΈInspirational
    • Trivia
    • Resi Map making inspiration
    • Max Teabag Map making inspiration
    • Reject Map making basics
    • Illijah's Map making experience
  • Placeholder
Powered by GitBook
On this page
  • Why are array actions required?
  • Examples of using an array
  • First Case: Basic Way to create the array.
  • Second Case, Loop the element through the array.
  • Third Case, empty array, add elements, loop the element.
  • Fourth Case, Joining 2 arrays.

Was this helpful?

  1. Tables of Level Editor
  2. Trigger Action Table
  3. Array

What is array?

Thanks to mici1234 for the explanation *applause*

What is Array? Arrays are simply list of "things".

What is a "thing"? It can be a number, a text, literally anything.

What matters is that array holds more than 1 "thing".

Think of list of numbers, or list of texts, or list of both numbers and texts.


Why are array actions required?

Before array actions were a thing, the "equivalent" array was using variables, more specifically variable holding a text SEPARATED by some character. One such example is blacklist, which is separated with /, so for example /mici1234/lisa/, then if you wanted to check whether an item is in that variable, you'd simply wrap the variable with / and check if it is included in the main "list".

This would work but what if you wanted to "index"? Basically, pick item at specific number? Or get length of the "list"? Because your "list" is simply texting a text with specific rule. At this point, you get arrays, which are actual proper lists, more specifically array actions are simply actions to interface with actual ActionScript3 arrays. ActionScript3 as you may know is language of PB2.

This allows you to do same things as text-list, but much more efficient and much easier. It is easy to get length, it is easy to index.

While it's not exactly convenient (There is no remove item action for example), it is definitely more convenient than having variable pretend to be a list.


Examples of using an array

First Case: Basic Way to create the array.

Paste this one into any trigger you desire and remember to add the USE region.

uid: #array_loop
enabled: true
maxcalls: -1

VarSetValue( "~ArrayString", "hello/world/forest/city" );
ShowText( "~ArrayString", "0" );
op349( "~ArrayString", "/" );
ShowText( "~ArrayString", "1" );
op350( "~ArrayString", "0" );
ShowText( "Counter: ~counter, Element: ~ArrayString", "2" );
VarAddValue( "~counter", "1" );

Result:

Task: How to print "forest" instead?


Second Case, Loop the element through the array.

For looping element, we had to prepare 2 triggers, first one is initiate the counter, the second one remains the same, just replace the index to the counter variable.

uid: #counter init
enabled: true
maxcalls: 1

VarSetValue( "~counter", "0" );
uid: #array_loop
enabled: true
maxcalls: -1

VarSetValue( "~ArrayString", "hello/world/forest/city" );
op349( "~ArrayString", "/" );
op350( "~ArrayString", "~counter" );
ShowText( "Counter: ~counter, Element: ~ArrayString", "2" );
VarAddValue( "~counter", "1" );

Result:

Task: what happens if the player pressed the button again?


Third Case, empty array, add elements, loop the element.

In the first 2 cases, the array is created by simply separating the string with a symbol. In this case, we are going to build a fresh, empty array and we are going to insert the element one by one.

Here's the code for your startup:

uid: #counter init
enabled: true
maxcalls: 1

VarSetValue( "~counter", "0" );
uid: #array_loop
enabled: true
maxcalls: -1

op354( "~ArrayString", "0" );
op352( "~ArrayString", "hello" );
op352( "~ArrayString", "world" );
op352( "~ArrayString", "forest" );
op352( "~ArrayString", "city" );
op350( "~ArrayString", "~counter" );
ShowText( "Counter: ~counter, Element: ~ArrayString", "2" );
VarAddValue( "~counter", "1" );

Result:

Task: How to insert, delete a specific elements in an array?


Fourth Case, Joining 2 arrays.

There's one more trigger action we haven't used, whhich is join the arrays.

Here's the code for you to start up:

uid: #array_loop
enabled: true
maxcalls: -1

op354( "~ArrayString", "0" );
VarSetValue( "~combined", "alpha/beta/gamma/delta" );
op349( "~combined", "/" );
op352( "~ArrayString", "hello" );
op352( "~ArrayString", "world" );
op352( "~ArrayString", "forest" );
op405( "~combined", "~ArrayString" );
ShowText( "Combined Array: ~combined", "2" );

Result:

Task: Given ~ArrayString and ~combined, both arrays, modify the code to show the output as:

alpha, beta, gamma, delta, hello, world, forest
PreviousArrayNextMatrix Coloring System

Last updated 1 year ago

Was this helpful?

πŸͺ‘
no matter how hard you press, the counter is always 0, and it always print hello
the four elements are printing out.
the four elements are printing out too.
The join result