I never thought of this, as I only have limited knowledge of lua and rainmeter code, so I tried following your suggestion. It works, but when the value/string of the cperiod() changes, it doesn't visually show in the meter the change. Only does it change when I manually refresh the skin.death.crafter wrote: ↑October 14th, 2021, 9:40 am Lua doesn't really care where a function is defined. So that isn't a problem here. The problem is that the OP is returning before his work is done. Once return is used, function stops there and returns whatever is in parameter.
Actually no. You can use usual bangs too. And in my opinion, this is not quite efficient to break up a statement if you could write it in one line.
However, the above syntax is quite useful if you are trying to use lua values as parameters to the bang.
Also to the OP.
Have you considered using inline variables as value to the string meter you are using?
If you use an inline variable e.g. [&YourLuaScript:cperiod()], then you can skip the return part in Update.
Also, if you feel like cperiod is a quite heavy function, then you should not use it as a section variable and use what I described in the previous post.
It is currently June 10th, 2023, 3:56 am
SKIN:Bang not working
-
- Posts: 24
- Joined: September 14th, 2021, 10:27 am
Re: SKIN:Bang not working
-
- Rainmeter Sage
- Posts: 1398
- Joined: April 24th, 2021, 8:13 pm
Re: SKIN:Bang not working
Actually you need dynamicvariables=1 on the meter where you use this value. Also your skin needs to have a reasonable update, say 1000. This will work, or you may post the code here.FlightlessAz wrote: ↑October 14th, 2021, 1:05 pm I never thought of this, as I only have limited knowledge of lua and rainmeter code, so I tried following your suggestion. It works, but when the value/string of the cperiod() changes, it doesn't visually show in the meter the change. Only does it change when I manually refresh the skin.
I can't get to my pc for next some days. So you need to post the code here. Don't forget to use the code tags. The </> button up there.
from the Realm of Death
-
- Posts: 24
- Joined: September 14th, 2021, 10:27 am
Re: SKIN:Bang not working
When I tried your earlier suggestion, I already had dynamicvariables=1 in the meter displaying the string. Here is the code, as you requested.death.crafter wrote: ↑October 14th, 2021, 1:57 pm Actually you need dynamicvariables=1 on the meter where you use this value. Also your skin needs to have a reasonable update, say 1000. This will work, or you may post the code here.
I can't get to my pc for next some days. So you need to post the code here. Don't forget to use the code tags. The </> button up there.
scrolling-text-test.lua:
-
- Posts: 24
- Joined: September 14th, 2021, 10:27 am
Re: SKIN:Bang not working
is Update=15 reasonable? because my skin requires it to update that fast.death.crafter wrote: ↑October 14th, 2021, 1:57 pm Actually you need dynamicvariables=1 on the meter where you use this value. Also your skin needs to have a reasonable update, say 1000. This will work, or you may post the code here.
I can't get to my pc for next some days. So you need to post the code here. Don't forget to use the code tags. The </> button up there.
-
- Rainmeter Sage
- Posts: 15322
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: SKIN:Bang not working
Note a mistake in the code of the scrolling-text-test.lua script. The Cperiod function requires a parameter (being defined this way: function Cperiod(x)). But when you're calling it in the Update() function, the parameter is missing. Accordingly the function doesn't work correctly.FlightlessAz wrote: ↑October 15th, 2021, 2:29 am Here is the code, as you requested.
scrolling-text-test.lua:
scrolling-text-test.ini:
So far the skin is showing the running string. What else should it do?FlightlessAz wrote: ↑October 15th, 2021, 2:29 am As of now, I only made it so only the [ScrollingText] meter is displaying the string from the lua script.
No, in fact it isn't, because the lowest effective value for the Update option is 16. Lower values are not admitted, however if you use a lower one, the skin works as with Update=16, so this doesn't cause trouble. But Update=15 is not a valid value. For details see the second paragraph here.FlightlessAz wrote: ↑October 15th, 2021, 2:30 am is Update=15 reasonable? because my skin requires it to update that fast.
-
- Rainmeter Sage
- Posts: 1398
- Joined: April 24th, 2021, 8:13 pm
Re: SKIN:Bang not working
Actually your lua script looked a little flawed to me for various reasons. So I made some changes to it.
First thing was that you were performing actions on a stationary value of timemin and wday, which I turned into functions, so that would return the current time whenver called.
Also you were doing things in a little clumsy and redundant way, which is not an problem but cleaning up your code and reducing redundancy can help another person understand your code a little more efficiently.
Anyway that's not the issue. So here is a modified version of your code. I didn't write all the things but it's an outline.
I was editing your script on phone, so it might not be fully correct. Do yo can check it if you want to do it this way.
from the Realm of Death
-
- Rainmeter Sage
- Posts: 1398
- Joined: April 24th, 2021, 8:13 pm
Re: SKIN:Bang not working
That's not an mistake actually. It's probably the OP trying to debug his code or an desperate measure taken when nothing was working.balala wrote: ↑October 15th, 2021, 5:40 pm Note a mistake in the code of the scrolling-text-test.lua script. The Cperiod function requires a parameter (being defined this way: function Cperiod(x)). But when you're calling it in the Update() function, the parameter is missing. Accordingly the function doesn't work correctly.
Just an observation since the OP is comparing the value to null, that is if you actually give it a parameter, it won't work.
from the Realm of Death
-
- Posts: 24
- Joined: September 14th, 2021, 10:27 am
Re: SKIN:Bang not working
The reason for the first paragraph was because I was following death.crafter's suggestion to call the Cperiod() function inline in the .ini file. If i didn't put any parameter in the function, then it would only display [&mScript:Cperiod()] instead of the value/string of Cperiod() itself.balala wrote: ↑October 15th, 2021, 5:40 pm Note a mistake in the code of the scrolling-text-test.lua script. The Cperiod function requires a parameter (being defined this way: function Cperiod(x)). But when you're calling it in the Update() function, the parameter is missing. Accordingly the function doesn't work correctly.
So far the skin is showing the running string. What else should it do?
As for your second paragraph, depending on the time of the day, the string Cperiod() displays changes. What I wanted it to do was for the meter displaying the string of Cperiod() to automatically show the change visually. However, that only happens when I manually refresh the skin itself. Instead, it continues to display the previous string it displayed when it's supposed to change. For example, a certain string "a" is returned by Cperiod() when the time is 8:00 am and 9:00 am, and then between 9:00 am to 10:00 am, another string "b" is returned. The problem is, let us say it is currently 8:59 am, then the meter displays string "a," no problem. However, when the time turns to 9:00 am, when it's supposed to display string "b," it stays at string "a" until I manually refresh the skin itself.
I see, I wasn't informed about this.balala wrote: ↑October 15th, 2021, 5:40 pm No, in fact it isn't, because the lowest effective value for the Update option is 16. Lower values are not admitted, however if you use a lower one, the skin works as with Update=16, so this doesn't cause trouble. But Update=15 is not a valid value. For details see the second paragraph here.
-
- Rainmeter Sage
- Posts: 1398
- Joined: April 24th, 2021, 8:13 pm
Re: SKIN:Bang not working
I think you missed my post.FlightlessAz wrote: ↑October 16th, 2021, 1:35 am As for your second paragraph, depending on the time of the day, the string Cperiod() displays changes. What I wanted it to do was for the meter displaying the string of Cperiod() to automatically show the change visually. However, that only happens when I manually refresh the skin itself. Instead, it continues to display the previous string it displayed when it's supposed to change. For example, a certain string "a" is returned by Cperiod() when the time is 8:00 am and 9:00 am, and then between 9:00 am to 10:00 am, another string "b" is returned. The problem is, let us say it is currently 8:59 am, then the meter displays string "a," no problem. However, when the time turns to 9:00 am, when it's supposed to display string "b," it stays at string "a" until I manually refresh the skin itself.
https://forum.rainmeter.net/viewtopic.php?p=199092#p199092
from the Realm of Death
-
- Posts: 24
- Joined: September 14th, 2021, 10:27 am
Re: SKIN:Bang not working
Hello, I saw your post. It just so happened after composing my reply to balala that i had to go for a trip away from home, therefore I currently have no access to my laptop now, and I was supposed to tell you but I forgot to do so. Sorry for that, and I'll get back to you as soon as I'm back from my trip. Cheers!death.crafter wrote: ↑October 16th, 2021, 5:52 am I think you missed my post.
https://forum.rainmeter.net/viewtopic.php?p=199092#p199092
