Operators,Loops,Arrays
Some of these have already been explained before but i believe that they possibly could be bought up again.
Arrays
One dimesional:
Usuage: Variable[Number]
Uses: Storing information or values
Description: 1 Dimension arrays will store information you assign to them. You must initlise them a value for them to work.
Example: Banana[1]=20
Example2: Banana[i]=20
Example1 Explanation: This says that banana[1]=20, so the variable array banana[1] value is 20. you can now add and subtract the value
Example2 Explanation: This is harder to use, you must use the variable to init the array so before banana[i]=20 you must add i=1. This will say exactly the same as banana[1] now
Editing arrays: In a different event add (maybe Up or Down)
Banana[1]-=1 or Banana[1]+=1
2 Dimesional
Usuage: Variable[number,number]
Uses: Storing Co-ordinates/Values/Information
Description: These are more complex, use them in you want more than one value in an array
Example1: Worker[1,1]="Bob" Worker[1,2]="Wage:5000"
Example2: Worker[2,1]="Mary" Worker[2,2]="Wage:4650"
Example3: Xcord[object_index,id-100000]=x
Example4: Number[i,ii]=floor(random(100))
Example1&2 Explanation: Example1 has worker[val,val] as the array and the numbers as 1,1 and 1,2
1,1 value is equal to Bob and 1,2 is equal to wage:5000.
Example 3&4 Explanation: Example 3 i would use to define an objects position, it uses object_index as it's first dimesion and its own id as it's second. The reason i put id-100000 is becuase the array index can't go over 32000 Example 4 just uses variables you need to initise before writing that code e.g i=1 ii=1
Editing arrays: In a different event add (maybe Up or Down)
if worker[0,1]="Bob
{
worker[0,1]="Joe"
}
else
{
worker[0,1]="Bob"
}
Arrays
One dimesional:
Usuage: Variable[Number]
Uses: Storing information or values
Description: 1 Dimension arrays will store information you assign to them. You must initlise them a value for them to work.
Example: Banana[1]=20
Example2: Banana[i]=20
Example1 Explanation: This says that banana[1]=20, so the variable array banana[1] value is 20. you can now add and subtract the value
Example2 Explanation: This is harder to use, you must use the variable to init the array so before banana[i]=20 you must add i=1. This will say exactly the same as banana[1] now
Editing arrays: In a different event add (maybe Up or Down)
Banana[1]-=1 or Banana[1]+=1
2 Dimesional
Usuage: Variable[number,number]
Uses: Storing Co-ordinates/Values/Information
Description: These are more complex, use them in you want more than one value in an array
Example1: Worker[1,1]="Bob" Worker[1,2]="Wage:5000"
Example2: Worker[2,1]="Mary" Worker[2,2]="Wage:4650"
Example3: Xcord[object_index,id-100000]=x
Example4: Number[i,ii]=floor(random(100))
Example1&2 Explanation: Example1 has worker[val,val] as the array and the numbers as 1,1 and 1,2
1,1 value is equal to Bob and 1,2 is equal to wage:5000.
Example 3&4 Explanation: Example 3 i would use to define an objects position, it uses object_index as it's first dimesion and its own id as it's second. The reason i put id-100000 is becuase the array index can't go over 32000 Example 4 just uses variables you need to initise before writing that code e.g i=1 ii=1
Editing arrays: In a different event add (maybe Up or Down)
if worker[0,1]="Bob
{
worker[0,1]="Joe"
}
else
{
worker[0,1]="Bob"
}
Labels: Advanced
