# Ignition Maker Edition Events Not Firing

**URL:** <https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886>\
**Category:** Maker\
**Tags:** scripting\
**Created:** [September 30, 2023, 3:25pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886 "2023-09-30T15:25:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carson\_Pool](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Carson\_Pool](https://forum.inductiveautomation.com/u/Carson_Pool)\
**Post date:** [September 30, 2023, 3:25pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/1 "2023-09-30T15:25:14Z")

</div>

I am new to ignition and I am trying to make a simple thing to control two widgets with a slider. I have a toggle switch to switch what tag to set

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/82fcf4fd26223817e7e06bb5ebcd12f262909421.png)  
The toggle switch is bound to a tag called `SetTemp`  
I have the same code running on the switch's onActionPreformed and onClick event. I also have it on the tag's change event but still not running.  
The code is

```auto
print("Event Fired")
Test.GetTagValue("Temp") # My Code

```

The console has no output. No error. Nothing.  
The tag's value does change with the toggle switch

---

<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:** [September 30, 2023, 3:37pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/2 "2023-09-30T15:37:34Z")

</div>

> The toggle switch is ~~set~~ **bound** to a tag called `SetTemp`.

`print("Event Fired")`  
This should be  
`system.perspective.print("Event Fired")`  
if you want it to appear in Designer Console.

`Test.GetTagValue("Temp") # My Code`  
That won't work. To write to a tag use  
[https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking](https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking)

You're going to have difficulty switching stuff. I'd recommend using a coordinate container, put two sliders on top of each other and toggle their visibility using the toggle switch. Bind one gauge to each slider.

---

<div class="post-metadata">

**Author:** ![Carson\_Pool](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Carson\_Pool](https://forum.inductiveautomation.com/u/Carson_Pool)\
**Post date:** [September 30, 2023, 3:48pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/3 "2023-09-30T15:48:16Z")

</div>

> [@Transistor](#):
>
> `Test.GetTagValue("Temp") # My Code`  
> That won't work. To write to a tag use

Why won't it. It is a function I defined where I do my logic and write to the tags

> [@Transistor](#):
>
> You're going to have difficulty switching stuff. I'd recommend using a coordinate container, put two sliders on top of each other and toggle their visibility using the toggle switch. Bind one gauge to each slider.

I want a challenge to get used to scripting in ignition

Edit: I will probably change the name of the function

---

<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:** [September 30, 2023, 3:50pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/4 "2023-09-30T15:50:50Z")

</div>

> [@Carson\_Pool](#):
>
> It is a function I defined where I do my logic and write to the tags

That wasn't clear from your post and you didn't supply the code for that function.

---

<div class="post-metadata">

**Author:** ![Carson\_Pool](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Carson\_Pool](https://forum.inductiveautomation.com/u/Carson_Pool)\
**Post date:** [September 30, 2023, 3:54pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/5 "2023-09-30T15:54:31Z")

</div>

> [@Transistor](#):
>
> That wasn't clear from your post and you didn't supply the code for that function.

I put a comment saying `# My Code`  
Also the print wasn't running. I didn't think that the code for that function mattered.

I am new to these fourms so I don't know what info needs to be provided but the code for the function right now is

```auto
def GetTagValue(name=""):
	system.perspective.print("Running")
	tags = system.tag.browse("/")[1:]
	tag = None
	for i in tags:
		if i["name"] == name:
			tag = i
	if tag == None:
		return None
	system.perspective.print(tag)

```

It doesn't write for right now because I want to see if it can get a tag but it doesn't run. Even with `system.perspective.print` there is nothing in the logs

---

<div class="post-metadata">

**Author:** ![Carson\_Pool](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Carson\_Pool](https://forum.inductiveautomation.com/u/Carson_Pool)\
**Post date:** [September 30, 2023, 4:02pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/6 "2023-09-30T16:02:53Z")

</div>

I set the code to write `False` to the tag whenever the tag changes and that works. So now it turns into why is `system.perspective.print` not working

Edit: Code

```auto
system.tag.writeBlocking([tagPath], [False])
system.perspective.print("Event Fired")

```

---

<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:** [September 30, 2023, 4:05pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/7 "2023-09-30T16:05:33Z")

</div>

> [@Carson\_Pool](#):
>
> why is `system.perspective.print` not working

Because your script is running on the gateway. Designer Console can't see it. You need to use a logger.

[https://docs.inductiveautomation.com/display/DOC81/system.util.getLogger](https://docs.inductiveautomation.com/display/DOC81/system.util.getLogger)

A quick and easy way to debug is to create a debug string tag and write to that from the script.

---

<div class="post-metadata">

**Author:** ![Carson\_Pool](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@Carson\_Pool](https://forum.inductiveautomation.com/u/Carson_Pool)\
**Post date:** [September 30, 2023, 4:13pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/8 "2023-09-30T16:13:59Z")

</div>

> [@Transistor](#):
>
> You need to use a logger.

That still wasn't showing in the console. I have 0 idea of what I am doing

> [@Transistor](#):
>
> A quick and easy way to debug is to create a debug string tag and write to that from the script.

I did that and that works.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 30, 2023, 7:27pm UTC](https://forum.inductiveautomation.com/t/ignition-maker-edition-events-not-firing/79886/9 "2023-09-30T19:27:59Z")

</div>

> [@Transistor](#):
>
> Because your script is running on the gateway. Designer Console can't see it. You need to use a logger.

This isn't accurate. The `system.perspective.print()` usage should be printing to the Designer Console when used from events. If it is not, then something else is going on. The original `print()` command will NOT be printed in the Designer Console, as generic `print()` invocations go to the... `wrapper.log`(?) file.

The most likely cause is this piece of the snippet:

```auto
if tag == None:
    return None
system.perspective.print(tag)

```

In the result the `tag` variable is indeed `None`, the final `system.perspective.print()` invocation will not be reached.

This part of the provided code can be entirely replaced as it is redundant; you've already set `tag` to be `None`, and only overwritten that value in the event the name is found.

```python
# Change all of this....
if tag == None:
    return None
system.perspective.print(tag)

# to this:
system.perspective.print("Tag: {0}".format(str(tag)))
return tag

```
