Decorate actors can have some internal general-purpose values that could be set and checked via action functions, like this:
A_SetVal(1,100) // Val[1]=100
A_SetValRand(8,50,70) // Val[8]=Random(50,70)
A_JumpValEQ(5,50) // if (Val[5]==50) {}
A_JumpValIN(4,30,40) // if (Val[4]>=30 && Val[4]<=40) {}
A_JumpValLT(7,10) // if (Val[7]<10) {}
A_JumpValGT(...
Some arithmetic:
A_AddVal(5,7) // Val[5]=Val[5]+7
A_AddVals(5,7) // Val[5]=Val[6]+Val[7]
A_SubVals(...
Some bonus actions:
A_SetValToHealth(3) // Val[3]=Actor.Health
A_SetValToSectorLight...
A_SetValToHeight...
A_SetValToTargetHeight...
A_SetValToTargetDist...
Some bool results:
A_SetVal_if_WaterZone(1) // if (Actor_in_WaterZone) {Val[1]=1} else {Val[1]=0}
Set an internal value to reflect a flag bit of the actor:
A_SetVal_to_FlagBit(5,flagFloating) // if (Actor_is_Floating) {Val[5]=1} else {Val[1]=0}
--------------------------------
OK, here is another way of communication between ACS and DECORATE:
Thing_SetValue(tid, val_index, value); // Sets an internal value of the things
a=Thing_GetValue(tid, val_index); // Retrieves an internal value of the things
--------------------------------
We can have some global values that are shared and accessed by all the actors, useful for communication between them, setting alarms, coordinating movements, and so on...
A_SetGlobal(1,100) // Global[1]=100
A_JumpGlobalEQ(5,50) // if (Global[5]==50) {}
A_JumpGlobalLT(7,10) // if (Global[7]<10)
A_JumpGlobalGT(...
Some value exchange:
A_GlobalToVal(2,5) // Val[2]=Global[5]
A_ValToGlobal(2,5) // Global[2]=Val[5]
A_AddGlobal(2,-10) // Global[2]=Global[2]-10
A_AddValToGlobal(2,5) // Global[2]= Global[2]+Val[5]
A_AddGlobalToVal(2,5) // Val[2]=Val[2]+Global[5]
Some ACS Functions:
Decorate_SetGlobalValue(5,7) // Decorate.Global[5]=7
a=Decorate_GetGlobalValue(5) // a=Decorate.Global[5]
Thus, we can control internal states of the actors via ACS scripts, or globally change their behaviors.
