Always trouble with accums


(Wezelkrozum) #1

Hi,
I’m an advanced mapper and the only thing I have always trouble with are the accums. So, please get me out of this.

2 problems (the first is the problem now and the 2nd is the problem i’ve always had):

  1. The globalaccum won’t save globalaccum bitset 21
  2. The accums won’t save anything. I use accum abort_if_not_equal in the same scriptname
    , but it will always stop there. Also when I set an accum.

(isbowhten) #2

can you send script?
accum indexes must be between 0 and 9
=> bitset 21 doesnt exist


(TomTom7777) #3

And globalaccums indexes between 0 and 7 unless you are scripting for a mod that fixes the ET bugs.


(isbowhten) #4

really?
i used successfully globalaccums up to index 9


(TomTom7777) #5

Go to the source:
WET_source\src\game\g_local.h
883: #define MAX_SCRIPT_ACCUM_BUFFERS 8

1002: int globalAccumBuffer[MAX_SCRIPT_ACCUM_BUFFERS];

Globalaccum index 8 and 9 likely corrupt and are corrupted by the soldierChargeTime variable.

That fact that ET allows you to index 8 and 9 is because it checks (in g_script_actions.c 595) the index against ;
180: #define G_MAX_SCRIPT_ACCUM_BUFFERS 10

I believe some mods fix this (ET Pro???). But the bug persists in others (ETmain, FritzBot ET…)


(isbowhten) #6

ok … then i had good luck that it worked with globalaccum 8 and 9


(Wezelkrozum) #7

Ok guys thanx for that. Does anyone know a solution to activate the accums? The globalaccums works but the accums don’t.


(Flippy) #8

It doesn’t make sense that your accums ‘don’t work’. They can’t just not work for you but work for everyone else, unless you modified the game… Are you sure you are doing everything correct?
Post an example script to explain what exactly you think is wrong.

I assume you are aware that non-global accums only ‘work’ within the same scriptblock?

For example:

scriptname_1
{
   spawn
   {
        accum 0 set 0
   }
  
   trigger bla
   {
        accum 0 abort_if_not_equal 0
        // Script will continue here
   }
}

scriptname_2
{
   spawn
   {
        accum 0 abort_if_not_equal 0
        // script will ABORT here, because accum 0 'does not exist'
   }
}

(nUllSkillZ) #9

Accums can also be used to store bits (states of on and off).
The script actions:


accum <n> bitset <m>
accum <n> bitreset <m>
accum <n> abort_if_bitset <m>
accum <n> abort_if_not_bitset <m>

Not sure how many bits can be used per accum (AFAIR 16).


(Wezelkrozum) #10

//// boter kaas en eieren
// accum 9 

bke
{
	spawn
	{
		wait 10
		accum 9 set 0
	}

//control or a team wins

	trigger 3_control
	{
		wait 20

		//horizontal
		trigger self 3_control_allies_11_12_13
		trigger self 3_control_axis_11_12_13

		trigger self 3_control_allies_21_22_23
		trigger self 3_control_axis_21_22_23

		trigger self 3_control_allies_31_32_33
		trigger self 3_control_axis_31_32_33

		wait 20
		//vertical
		trigger self 3_control_allies_11_21_31
		trigger self 3_control_axis_11_21_31

		trigger self 3_control_allies_12_22_32
		trigger self 3_control_axis_12_22_32

		trigger self 3_control_allies_13_23_33
		trigger self 3_control_axis_13_23_33

		wait 20
		//cross
		trigger self 3_control_allies_11_22_33
		trigger self 3_control_axis_11_22_33

		trigger self 3_control_allies_31_22_13
		trigger self 3_control_axis_31_22_13
	}

	trigger 3_control_allies_11_12_13
	{
		accum 9 abort_if_not_bitset 1
		accum 9 abort_if_not_bitset 3
		accum 9 abort_if_not_bitset 5
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_11_12_13
	{
		accum 9 abort_if_not_bitset 2
		accum 9 abort_if_not_bitset 4
		accum 9 abort_if_not_bitset 6
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_21_22_23
	{
		accum 9 abort_if_not_bitset 11
		accum 9 abort_if_not_bitset 13
		accum 9 abort_if_not_bitset 15
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_21_22_23
	{
		accum 9 abort_if_not_bitset 12
		accum 9 abort_if_not_bitset 14
		accum 9 abort_if_not_bitset 16
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_31_32_33
	{
		accum 9 abort_if_not_bitset 21
		accum 9 abort_if_not_bitset 23
		accum 9 abort_if_not_bitset 25
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_31_32_33
	{
		accum 9 abort_if_not_bitset 22
		accum 9 abort_if_not_bitset 24
		accum 9 abort_if_not_bitset 26
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_11_21_31
	{
		accum 9 abort_if_not_bitset 1
		accum 9 abort_if_not_bitset 11
		accum 9 abort_if_not_bitset 21
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_11_21_31
	{
		accum 9 abort_if_not_bitset 2
		accum 9 abort_if_not_bitset 12
		accum 9 abort_if_not_bitset 22
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_12_22_32
	{
		accum 9 abort_if_not_bitset 3
		accum 9 abort_if_not_bitset 13
		accum 9 abort_if_not_bitset 23
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_12_22_32
	{
		accum 9 abort_if_not_bitset 4
		accum 9 abort_if_not_bitset 14
		accum 9 abort_if_not_bitset 24
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_13_23_33
	{
		accum 9 abort_if_not_bitset 5
		accum 9 abort_if_not_bitset 15
		accum 9 abort_if_not_bitset 25
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_13_23_33
	{
		accum 9 abort_if_not_bitset 6
		accum 9 abort_if_not_bitset 16
		accum 9 abort_if_not_bitset 26
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_11_22_33
	{
		accum 9 abort_if_not_bitset 1
		accum 9 abort_if_not_bitset 13
		accum 9 abort_if_not_bitset 25
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_11_22_33
	{
		accum 9 abort_if_not_bitset 2
		accum 9 abort_if_not_bitset 14
		accum 9 abort_if_not_bitset 26
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_allies_31_22_13
	{
		accum 9 abort_if_not_bitset 21
		accum 9 abort_if_not_bitset 13
		accum 9 abort_if_not_bitset 5
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}

	trigger 3_control_axis_31_22_13
	{
		accum 9 abort_if_not_bitset 22
		accum 9 abort_if_not_bitset 14
		accum 9 abort_if_not_bitset 6
		setstate bke_axis_teleporter_trigger default
		setstate bke_allies_teleporter_trigger default
	}


//which team starts

	trigger allies_start
	{
		wait 100
		accum 9 set 1
	}

	trigger axis_start
	{
		wait 100
		accum 9 set 2
	}

	trigger allies_1_1
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_1_1_blue default
		setstate bke_allies_1_1 invisible
		setstate bke_axis_1_1 invisible
		wait 4
		accum 9 bitset 1
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_1_2
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_1_2_blue default
		setstate bke_allies_1_2 invisible
		setstate bke_axis_1_2 invisible
		wait 4
		accum 9 bitset 3
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_1_3
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_1_3_blue default
		setstate bke_allies_1_3 invisible
		setstate bke_axis_1_3 invisible
		wait 4
		accum 9 bitset 5
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_2_1
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_2_1_blue default
		setstate bke_allies_2_1 invisible
		setstate bke_axis_2_1 invisible
		wait 4
		accum 9 bitset 11
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_2_2
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_2_2_blue default
		setstate bke_allies_2_2 invisible
		setstate bke_axis_2_2 invisible
		wait 4
		accum 9 bitset 13
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_2_3
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_2_3_blue default
		setstate bke_allies_2_3 invisible
		setstate bke_axis_2_3 invisible
		wait 4
		accum 9 bitset 15
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_3_1
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_3_1_blue default
		setstate bke_allies_3_1 invisible
		setstate bke_axis_3_1 invisible
		wait 4
		accum 9 bitset 21
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_3_2
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_3_2_blue default
		setstate bke_allies_3_2 invisible
		setstate bke_axis_3_2 invisible
		wait 4
		accum 9 bitset 23
		wait 4
		accum 9 set 2
		trigger self 3_control
	}

	trigger allies_3_3
	{
		accum 9 abort_if_not_equal 1
		accum 9 set 3
		wait 4
		setstate bke_3_3_blue default
		setstate bke_allies_3_3 invisible
		setstate bke_axis_3_3 invisible
		wait 4
		accum 9 bitset 35
		wait 4
		accum 9 set 2
		trigger self 3_control
	}


	trigger axis_1_1
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_1_1_red default
		setstate bke_allies_1_1 invisible
		setstate bke_axis_1_1 invisible
		wait 4
		accum 9 bitset 2
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_1_2
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_1_2_red default
		setstate bke_allies_1_2 invisible
		setstate bke_axis_1_2 invisible
		wait 4
		accum 9 bitset 4
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_1_3
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_1_3_red default
		setstate bke_allies_1_3 invisible
		setstate bke_axis_1_3 invisible
		wait 4
		accum 9 bitset 6
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_2_1
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_2_1_red default
		setstate bke_allies_2_1 invisible
		setstate bke_axis_2_1 invisible
		wait 4
		accum 9 bitset 12
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_2_2
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_2_2_red default
		setstate bke_allies_2_2 invisible
		setstate bke_axis_2_2 invisible
		wait 4
		accum 9 bitset 14
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_2_3
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_2_3_red default
		setstate bke_allies_2_3 invisible
		setstate bke_axis_2_3 invisible
		wait 4
		accum 9 bitset 16
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_3_1
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_3_1_red default
		setstate bke_allies_3_1 invisible
		setstate bke_axis_3_1 invisible
		wait 4
		accum 9 bitset 22
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_3_2
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_3_2_red default
		setstate bke_allies_3_2 invisible
		setstate bke_axis_3_2 invisible
		wait 4
		accum 9 bitset 24
		wait 4
		accum 9 set 1
		trigger self 3_control
	}

	trigger axis_3_3
	{
		accum 9 abort_if_not_equal 2
		accum 9 set 3
		wait 4
		setstate bke_3_3_red default
		setstate bke_allies_3_3 invisible
		setstate bke_axis_3_3 invisible
		wait 4
		accum 9 bitset 36
		wait 4
		accum 9 set 1
		trigger self 3_control

	}
}

So, why don’t work the accum?


(Wezelkrozum) #11

I had used to much characters so here is the continue of my post:

This is the script of one scriptname the others use globalaccums, but now my globalaccums are all used for something else so I need accums. But the accum won’t work. The bitsets don’t mind. I’m going to change that.


(kamikazee) #12

You are using accum 9:

accum 9 set 0

Don’t do that. As TomTom7777 said, accums number 8 and 9 could get corrupted by the game or might mess up the soldier’s charge time (possibly allowing a hack to make soldiers shoot panzers fast).


(Wezelkrozum) #13

i changed accum 9 to accum 1 but this also won’t work.


(Zer0Cool) #14

And globalaccums indexes between 0 and 7 unless you are…

AFAIK this does not count for normal accums


(TomTom7777) #15

The corruption is only on high index globalsaccums.
Regular accums are fine;

180 #define G_MAX_SCRIPT_ACCUM_BUFFERS 10
409 int scriptAccumBuffer[G_MAX_SCRIPT_ACCUM_BUFFERS];
so accum 8 and 9 can be used.

That being said use the lower indexes first because they are easier to debug as Printaccum does not work above index 7 (see g_script_actions.c 3454)

That I understand. Why wezelkrozum is changing his accums at 4 ms intervals I do not understand…


Ah Ha well you better not use bitset or bitresets like


		accum 9 bitset 35
. . .
		accum 9 bitset 36

I didn’t see any range checking in g_script_actions for bit operations. If you exceed bit index 31 you may or may not corrupt, but you certainly won’t get the value you expect.

Also wezelkrozum, you appear to be using accum 9 for 2 different tasks. If I understand your code accum 9 set Values 1, 2 and 3 are sort of a who’s turn it is. And the bitsets are who holds a square on the board. In which case the former sets are wiping out any bitsets. And your bits and sets are overlapping. ET script does not support masking so stick to doing just one of these tasks for now. You have 9 more accums you can use.


(isbowhten) #16

anyone know what that script is about? xD
i do not understand the script at all.
might help if it would be explained and perhaps which entities are used?
i testes bitset …
seems like you have endless bit indexes.
i stopped testing after the number of the index has been so big that if it would be bits, it would be 240 GB
xD even negative values are allowed and float values but the decimal places were cut away.


(TomTom7777) #17

I think it is about a tic-tac-toe like board

trigger 3_control calls the 8 tests for a completed line.
There are 2 bits per square one for each team.

the trigger allies_1_1 through trigger axis_3_3 are what set the squares. However the accum 9 set at the end of each of these wipes out the bitset so the game never recognizes a winner.


(Wezelkrozum) #18

TomTom777 you won! :slight_smile: haha. You’re right. It’s tic-tac-toe. But it could be played when the accum work. :stuck_out_tongue: I’m currently working on a mingames map.


(isbowhten) #19

don’T forget a rollercoaster xD
the accums do work… check if the triggers are executed and use printaccum.
accums always work… check if you did abort if NOT and you really meant NOT …
i often mean abort_if but write abort_if_not or opposite way round.
the mistake could be in the routines which define which field has been chosen.
but the posted script are ONLY the check routines


(nUllSkillZ) #20

Explanation of the bits:
Help with the Accum command
2nd post

So you can hold 32 bits per accum (not 16 as I assumed).