Simple Count Up Counter

Ok, so I do not know scripting yet, just learning. So I did not do any initial value or anything, just trying out a simple count up for now.

I have created one memory tag called "ST 10 Fault Counter" data type INT. This is my counter.

Another memory tag called "Test Count 2" data type bool.

I then added this script to "Test Counter 2"

Here are the paths:
Test Counter 2 scripts to ST 10 Fault Counter and works.

cnt2

Now I created a second memory tag called "ST 20 Fault Counter" with data type INT. This is another counter.

I then created a "Test Count" tag with data type BOOL and added this script:

The script in "Test Count" memory tag does not work with the "ST 20 Fault Counter" I created.

I ran both scripts in the Designer script console and no syntax error.
This code works for ST 10 Fault Counter

This code for some reason that I cannot figure out does not work. The INT never increments when the BOOL goes TRUE.

I tried changing one counter to counter1, but that did not work. Maybe a path issue?

To recap - Test Counter 2 script does enable ST 10 Fault Counter INT value in increase.

Test Count script does NOT enable St 20 Fault Counter INT value to increase.

Any help would be appreciated.

Also, if I go back into the working Test Counter 2 script and change the path from
"[default]Line F Neo Rivet/Station Faults/Fault Counters/ST 10 Fault Counter "

to "[default]Line F Neo Rivet/Station Faults/Fault Counters/ST 20 Fault Counter " it will NOT work, but if I change the paths back to the /ST 10 ....it does work.....odd to me...

Ha! :slight_smile:

Ok, yes it was the spacing on the COPY PATH. I had typed it in and one entry had a little more spacing...

Well that is the second time this spacing has got me......

I strongly recommend not using spaces in tag names and tag folder names. (I further recommend using names that qualify as python identifiers, but that is a bit too far for some people.)

1 Like