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 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.
Counter
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
I unfortunately did not understand what you mean.
Pako
Pako
Re: Counter
I mean counter count event ex: keyboard button pres and trigger curent macro at set number.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
Have you tried the Multitap plugin - specifically Single Key mode?
Pako
Pako
Re: Counter
Hi yes i try to use it. I want to make something like this: https://www.youtube.com/watch?v=M_X-KrfMF-4
and use eventghost to count visitors. For exsample keyboard 1 then 2 counts as one next 1 then 2 count as 2 then3...4...5
but 2 then 1 counts backwards.
and use eventghost to count visitors. For exsample keyboard 1 then 2 counts as one next 1 then 2 count as 2 then3...4...5
but 2 then 1 counts backwards.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
Yes, now I finally understand.nikus_v13 wrote:I want to make something like this: https://www.youtube.com/watch?v=M_X-KrfMF-4
and use eventghost to count visitors.
In this case, we do not need a new feature.
Similar things you can do using EventGhost for many years.
This can be solved in different ways.
Here you see one of them (you may need to add the Webserver plugin to your configuration):Here's a copy of that part of the tree (you can do copy / paste to tree):
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1640">
<Folder Name="Counter - demo" Expanded="True">
<Macro Name="Webserver: Increment persistent value: visitorCounter" Expanded="True">
<Event Name="Main.VisitorPlus" />
<Action>
Webserver.GetPersistentValue(u'visitorCounter')
</Action>
<Action>
EventGhost.PythonCommand(u'eg.result=str(int(eg.result)+1) if eg.result is not None else "1"')
</Action>
<Action>
Webserver.SetPersistentValue(u'visitorCounter', u'{eg.result}')
</Action>
<Action>
Webserver.GetPersistentValue(u'visitorCounter')
</Action>
<Action>
EventGhost.ShowOSD(u'{eg.result}', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;66;Comic Sans MS', (255, 0, 0), (0, 0, 0), 1, (5, 5), 0, 0.0, True)
</Action>
</Macro>
<Macro Name="Webserver: Decrement persistent value: visitorCounter" Expanded="True">
<Event Name="Main.VisitorMinus" />
<Action>
Webserver.GetPersistentValue(u'visitorCounter')
</Action>
<Action>
EventGhost.PythonCommand(u'eg.result=str(int(eg.result)-1) if eg.result is not None else "0"')
</Action>
<Action>
Webserver.SetPersistentValue(u'visitorCounter', u'{eg.result}')
</Action>
<Action>
Webserver.GetPersistentValue(u'visitorCounter')
</Action>
<Action>
EventGhost.ShowOSD(u'{eg.result}', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;66;Comic Sans MS', (255, 0, 0), (0, 0, 0), 1, (5, 5), 0, 0.0, True)
</Action>
</Macro>
</Folder>
</EventGhost>Re: Counter
I can't use version 1640. Maybe you have another solution ?
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
You can find several solutions. For example:nikus_v13 wrote:I can't use version 1640. Maybe you have another solution ?
1) You can try to use the latest version of the Webserver plugin in your program version.
2) You can use global variables instead of persistent variables of Webserver pluginPako
Re: Counter
OK I make a counter but what I have to do to eventghost respond to 1 and 0 fo ex send comand by winlirc plugin ?
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
I'm sorry, but I do not understand your question.
What do you mean by "fo ex send comand"?
Pako
What do you mean by "fo ex send comand"?
Pako
Re: Counter
Sorry... for exsample send code I want to mak something to turn on or off the lights if some one enter or leaves a room I'v got almost entire house controled by eventghost and winlirc.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
I have a lack of information from you. I do not know your situation and I do not know how you can to control light using WinLIRC.
However, I understand that you need an event when the first visitor comes into the room and an event when the last visitor leaves.
So you can do such as the following:
1) Use Python Script actions instead of Python Command actionsCode for incrementation:Code for decrementation:2) Then you get the necessary events:Pako
However, I understand that you need an event when the first visitor comes into the room and an event when the last visitor leaves.
So you can do such as the following:
1) Use Python Script actions instead of Python Command actionsCode for incrementation:
Code: Select all
eg.globals.visitorCounter = 1 if not "visitorCounter" in eg.globals.__dict__ else eg.globals.visitorCounter + 1
if eg.globals.visitorCounter == 1:
eg.TriggerEvent("Turn.On", prefix = "Light")Code: Select all
eg.globals.visitorCounter = 0 if not "visitorCounter" in eg.globals.__dict__ else eg.globals.visitorCounter - 1
if eg.globals.visitorCounter == 0:
eg.TriggerEvent("Turn.Off", prefix = "Light")Re: Counter
I not working... Light is controled by winLIRC by ir codes
https://www.youtube.com/watch?v=TKNPElUFtpM one of the rooms
https://www.youtube.com/watch?v=TKNPElUFtpM one of the rooms
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Counter
It WORKS.
I tried it and then I used the copy / paste.
And BTW - next time please include FULL error message.
According to this piece, I can not say exactly where you made a mistake.
But it is certain that it is a problem indentation.
Find information about the Python indentation on the Internet !
One more note:
I have a feeling that you are behaving as when this is a paid support.
I see very little effort on your part (including writing posts here).
You're the one who wants to solve something and it seems that you spend less of your time than I do.
Pako
I tried it and then I used the copy / paste.
And BTW - next time please include FULL error message.
According to this piece, I can not say exactly where you made a mistake.
But it is certain that it is a problem indentation.
Find information about the Python indentation on the Internet !
One more note:
I have a feeling that you are behaving as when this is a paid support.
I see very little effort on your part (including writing posts here).
You're the one who wants to solve something and it seems that you spend less of your time than I do.
Pako
Re: Counter
You are right it's working! I had got too many spaces when i copy/paste code. THANKS for your help !