Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

"If variable equals value then" problem

If you have a question or need help, this is the place to be.
Post Reply
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

"If variable equals value then" problem

Post by Mastiff »

I am no good at Python... I'm not very good in Lua, but at least I can make a simple if then, but Python? No way... I have a wind sensor, and I want to convert the wind direction letters to Norwegian words, so SSE is "S├©r-s├©r├©st". What I've tried is this:

Code: Select all

(if eg.globals.Wind_direction = = SSE:
    eg.globals.Wind_direction_norwegian = "Sør-sørøst"
    )
Of course that doesn't work. I tried with only one = in the first line, but that didn't change anything. The "& oslash;" (without the space) is the HTML code for the norwegian letter ├©, since it seems that Python can't do that. So can anybody please tell me how do I do this?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: "If variable equals value then" problem

Post by Pako »

Code: Select all

if eg.globals.Wind_direction == "SSE":
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: "If variable equals value then" problem

Post by Mastiff »

Thanks, Pako! That worked! :D
Post Reply