Lua theme items

Discussion of Lua and LuaWML support, development, and ideas.

Moderators: Forum Moderators, Developers

Post Reply
Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Lua theme items

Post by Choicerer » May 26th, 2018, 10:12 am

I need my code to get executed every millisecond-second. The only lua theme item that seems to refresh that often is the timer (report_countdown), which updates every 10 milliseconds. The problem is however that in both local and lan games this code seems to work even with the timer turned off, but in online multiplayer it almost instantenously causes oos. Is there any workaround for this and if there isn't, is there any way to enforce using the timer on the user when they're using my mp modification?
Thanks.

User avatar
Ravana
Moderator
Posts: 1874
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Lua theme items

Post by Ravana » May 26th, 2018, 10:41 am

You should describe here why you want to run code so often. If only problem is that timer must be on, then you can end_level if it is off.

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: Lua theme items

Post by Choicerer » May 26th, 2018, 10:45 am

Thanks for the second idea. I need this for my trolling mod... It listens for events that trigger the trolling reactions, waits 3 seconds, displays the trolling message then only after a user specified interval can another trolling message appear.

enclave
Posts: 885
Joined: December 15th, 2007, 8:52 am

Re: Lua theme items

Post by enclave » May 26th, 2018, 11:12 pm

Choicerer wrote:
May 26th, 2018, 10:45 am
Thanks for the second idea. I need this for my trolling mod... It listens for events that trigger the trolling reactions, waits 3 seconds, displays the trolling message then only after a user specified interval can another trolling message appear.
have you tried synchronize choice on it?
It looks to me like it should work fine till trolling message after 3 seconds, but it will have problem with user specified interval... I'm not sure but I think that if you put your message into some event... and fire event instead of just [chat].. ([event] name.. [chat]... [/event] and use with [fire_event])
Because my unlimited timer seem to work without OOS only because it starts timing on turn refresh event... which happens on all clients at the same time... so i think it should work if you put everything that needs timing into events.. (at least in 1.12 my timer used to work, no idea for 1.14... havent tried it..) But who knows... whoooooooooo knows... i was surprized that i didnt need to synchronize choice my unlimited timer.. no idea why it works without oos... assume it's because everything that is timed is in events.. but idk..

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: Lua theme items

Post by Choicerer » May 27th, 2018, 12:05 am

I'm not sure if you understand, though... It does work, but only if the user switches the timer on.

enclave
Posts: 885
Joined: December 15th, 2007, 8:52 am

Re: Lua theme items

Post by enclave » May 27th, 2018, 12:56 pm

Choicerer wrote:
May 27th, 2018, 12:05 am
I'm not sure if you understand, though... It does work, but only if the user switches the timer on.
I guess you are still thinking that unlimited timer is using default timer.. how is the timer related at all? You can create your own timer! That's what unlimited timer does, it does not use built-in default timer...

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: Lua theme items

Post by Choicerer » May 27th, 2018, 1:18 pm

That's next to impossible though... As far as I know, because there are too many factors in the c++ code you can't simulate in lua, it's basically trying to simulate a lot of variables in your add-on using WML events and so on which is really weird, but if I remember correctly you can't do it anyway... But I'll check out your add-on.

EDIT: Oooh, I see your add-on actually removes those variables. I'll take a look at the code. Thanks!

Post Reply