OBS Lua I need a script that counts and prints a value per second

Wismaria

New Member
The script should multiply a certain value per second. So if the value is 10, the value should be 600 in one minute.
The update should appear every second. The value can be set in the script. I don't need an input mask for this.
The script should also take decimal places into account. like $10.34
You should only be able to select the scene. If the input mask for the value can be programmed quickly, please do so. ^^

I hope you can help me.
 

DCStrato

Member
Here is an attempt at your request. Install the Multiplier Lua Script, then ADD an "Increment Value/Sec" source to any scene and select what text source you want to update each second by what value. You can format the text source itself with any color, font, size, etc. The default number format is two decimal places or " printf directive %.2f". You can specify a different "standard printf" format for the number to override the default. For example using $%.2f would place the $ in front of your number as in your example. $%.1f would only show 1 decimal place. I did limited testing, but it seems to work. Hope this helps. D.C.
 

Attachments

  • Multipler.zip
    1.3 KB · Views: 32

Wismaria

New Member
Hello, yes it works as I imagined.. Great! But I wonder how I can map the thousands, millions and trillions as a point.

Example:
It outputs: 2731465678.74
He should spend: 2,731,465,678.74

If that would still work, I would be perfectly happy
 

Wismaria

New Member
Hello, yes it works as I imagined.. Great! But I wonder how I can map the thousands, millions and trillions as a point.

Example:
It outputs: 2731465678.74
He should spend: 2,731,465,678.74

If that would still work, I would be perfectly happy
the script should continue to run even after changing the scene and not start again at 0...
 

DCStrato

Member
Sorry, commas were not part of your original specification. It looks like you are only doing money, so max starting value is now 9999999.99 (penny less than 10,000,000), precision is .01, and the $ is standard format. Commas are now added by default. D.C.
 

Attachments

  • Multipler.zip
    1.3 KB · Views: 24

Wismaria

New Member
2023-02-27 20_27_13-OBS 29.0.2 (64-bit, windows) - Portable Mode - Profil_ Wismaria - Szenen_ ...png


unfortunately he doesn't put a comma. Or am I doing something wrong?

in german like 1.000.000,00 €
 

DCStrato

Member
Did you Refresh the Script in OBS. The new one has the same name and OBS may still be using the older version. Sorry I didn't get all the way to adding version numbers and just threw this together for you. I used your exact example here and it does show commas.
 

DCStrato

Member
Here is a screenshot from my OBS running the script with your starting number of 260,370
 

Attachments

  • Screenshot 2023-02-27 13-02-02.png
    Screenshot 2023-02-27 13-02-02.png
    59.8 KB · Views: 20

Wismaria

New Member
Did you Refresh the Script in OBS. The new one has the same name and OBS may still be using the older version. Sorry I didn't get all the way to adding version numbers and just threw this together for you. I used your exact example here and it does show commas.
i have restart OBS, no effect
 

Wismaria

New Member
Can you upload the script again with a different name? Not that the forum has problems with two ZIP files with the same name, and I'm still downloading the old one. ^^
 

khaver

Member
You have to be careful when dealing with comas and decimal points when users from around the globe may be using the script. Some countries swap the uses of them. You might think about adding a check box to also swap the use of them in your script.
 

Wismaria

New Member
1677532143985.png


Downloaded both ZIP files in the thread.. all have the same CRC. and strangely enough the same file date. That can not be right. All from this morning. Nothing from the afternoon of the day.
 

Wismaria

New Member
You have to be careful when dealing with comas and decimal points when users from around the globe may be using the script. Some countries swap the uses of them. You might think about adding a check box to also swap the use of them in your script.
sorry, I was able to program php, but lua.. I'm out of it.. ^^
 

DCStrato

Member
Here is the script with a new name. I'll look at adding the comma, decimal swap when I get time. D.C.
 

Attachments

  • multiplierwithcommas.zip
    1.4 KB · Views: 20

DCStrato

Member
Wismaria,

This version will allow using periods for 1000s separator and commas for decimal separator, and also exchanging the period for a space in the 1000s separator, also used by some countries. D.C.
 

Attachments

  • multiplierwithswap.zip
    1.6 KB · Views: 27

Wismaria

New Member
Hello and thank you. The zipfile probably swallowed the forum yesterday. The new one works wonderfully. Also a scene change works if you duplicate the script and integrate it in another scene so that it is invisible. So off the screen.

I'm at work right now and I'm going to check it out right this afternoon.

Since I am German, and translate this with the Microsoft keyboard in real time, I ask for eveltual errors to be lenient with the grammar.

See you later and have a nice day
Bis später und habt einen schönen Tag
 

Wismaria

New Member
Wow, It works perfectly! Thanks a lot for your help. I'm perfectly happy with that! For all Germans who also want to show the GEZ in the stream, here is the screenshot.

2023-02-28 14_47_47-OBS 29.0.2 (64-bit, windows) - Portable Mode - Profil_ Wismaria - Szenen_ ...png
 
Top