# Timer script isn't working or showing in gateway

**URL:** <https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [April 30, 2024, 9:43pm UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743 "2024-04-30T21:43:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel.C](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Daniel.C](https://forum.inductiveautomation.com/u/Daniel.C)\
**Post date:** [April 30, 2024, 9:43pm UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/1 "2024-04-30T21:43:52Z")

</div>

Hello, I'm trying to run a timer script (code found here on ignition) for incrementing a value by 1 but it doesn't work. The tag in question is a memory tag. The value of my tag in tag browser stays on 0 and the script doesn't show in the script gateway. I'm also not getting any errors in my logs. Does anyone know what the problem is?

Count = system.tag.read("Line1Counter")  
if Count.value \< 30000:  
New\_Count = Count.value + 1  
system.tag.write("Line1Counter",New\_Count)  
else:  
New\_Count = 0  
system.tag.write("Line1Counter",New\_Count)

 ![Screenshot 2024-04-30 163845](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9b7bc16b16c222cd4ea67e2d230e6cb0d84d3303.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 30, 2024, 9:46pm UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/2 "2024-04-30T21:46:11Z")

</div>

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). Then use the pencil icon below your question to edit and fix it. Otherwise we don't know if you've got your Python indentation right.

---

<div class="post-metadata">

**Author:** ![Daniel.C](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Daniel.C](https://forum.inductiveautomation.com/u/Daniel.C)\
**Post date:** [May 1, 2024, 7:48am UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/5 "2024-05-01T07:48:10Z")

</div>

Apologies about that and thank you. I added a screenshot of how it’s formatted in the gateway timer script

```python
Count = system.tag.read("Line1Counter")
if Count.value < 30000:
   New_Count = Count.value + 1
   system.tag.write("Line1Counter",New_Count)

else:
   New_Count = 0
   system.tag.write("Line1Counter",New_Count)

```

 ![IMG_4661](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/b/5b446ad3a430479aca1afaef3544e63e165b15d5.png)

---

<div class="post-metadata">

**Author:** ![Graham\_Dewdney](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/graham_dewdney/32/73139_2.png) [@Graham\_Dewdney](https://forum.inductiveautomation.com/u/Graham_Dewdney)\
**Post date:** [May 1, 2024, 9:07am UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/6 "2024-05-01T09:07:04Z")

</div>

The logs are in the gateway - under Status -\> Gateway Scripts -\> Timer tab.  
I copied your script and got an ERROR in the list, which showed multiple faults - my bad, I miscopied something - your script seems to run fine as it is.

You need to click the Save button in the Designer to get the Gateway to update after every change to the script!

---

<div class="post-metadata">

**Author:** ![Daniel.C](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Daniel.C](https://forum.inductiveautomation.com/u/Daniel.C)\
**Post date:** [May 1, 2024, 9:21am UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/7 "2024-05-01T09:21:23Z")

</div>

Many thanks! I feel so silly. I wasn’t saving the project afterwards.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 1, 2024, 9:27am UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/8 "2024-05-01T09:27:53Z")

</div>

General comments:

- `system.tag.read()` has been depreciated. You should be using [system.tag.readBlocking | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-readBlocking).
- Similarly `system.tag.write()` has been replaced with [system.tag.writeBlocking | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-writeBlocking).
- The code you posted doesn't match the screenshot. The posted code has three leading spaces on each indented line. The screen shot shows four on lines 3 and 4 and eight on lines 7 and 8. (Or one tab and two tabs.) This makes it very difficult to know for sure where the errors are.
- Both readBlocking and writeBlocking expect `[]` lists of tags and values. Code can be written like this (but not tested):

```python
Count = system.tag.readBlocking(["Line1Counter"]).value
if Count < 30000:
   system.tag.writeBlocking(["Line1Counter"], [Count + 1])
else:
   system.tag.writeBlocking(["Line1Counter"], [0])

```

- Also, as explained earlier, you can edit posts instead of deleting and reposting.

---

<div class="post-metadata">

**Author:** ![Graham\_Dewdney](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/graham_dewdney/32/73139_2.png) [@Graham\_Dewdney](https://forum.inductiveautomation.com/u/Graham_Dewdney)\
**Post date:** [May 1, 2024, 9:32am UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/9 "2024-05-01T09:32:53Z")

</div>

Don't worry about it... I reduced the script down to just writing 10 to the tag before I figured out it wasn't the script itself!

---

<div class="post-metadata">

**Author:** ![Daniel.C](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Daniel.C](https://forum.inductiveautomation.com/u/Daniel.C)\
**Post date:** [May 2, 2024, 10:04pm UTC](https://forum.inductiveautomation.com/t/timer-script-isnt-working-or-showing-in-gateway/89743/10 "2024-05-02T22:04:00Z")

</div>

Thank you! I’ll make those changes
