Search found 13 matches
- October 21st, 2017, 3:18 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutine / Schedule Lua code without freezing Wesnoth
Timer that catches up with target. At most 1 millisecond unrecoverable lag/gain per firing. Works in 1.13 3% cpu load ... local old_time = wesnoth.get_time_stamp() local old_report_countdown = wesnoth.theme_items.report_countdown local target = 1000 local dif, new_time local target2 = target functi...
- October 21st, 2017, 2:14 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutine / Schedule Lua code without freezing Wesnoth
Sapient, Hi. I don't quite get the part about resetting. I would think the lua virtual machine is fast enough and resetting old_time would only lose accuracy below milliseconds. The problem is that this old code gives perfectly accurate time in wesnoth 1.12: local old_report_countdown = wesnoth.them...
- October 20th, 2017, 2:05 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutine / Schedule Lua code without freezing Wesnoth
It would be nice if wesnoth's c++ can provide accurate time to lua.
Like wesnoth.realtime().
Like wesnoth.realtime().
- October 18th, 2017, 6:14 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutine / Schedule Lua code without freezing Wesnoth
Timing by calculating approximate conversion between fake time and real time in every second. It seems not accurate for counting 0.1 seconds. old_report_countdown = wesnoth.theme_items.report_countdown old_clock = os.clock() old_time = os.time() old_clock2 = os.clock() real_dt = 1.0 fake_dt = real_d...
- October 18th, 2017, 3:02 am
- Forum: Release Announcements, Compiling & Installation
- Topic: Wesnoth 1.13.8 (1.14 Beta 1)
- Replies: 106
- Views: 60855
Re: Wesnoth 1.13.8 (1.14 Beta 1)
Hi. I don't know if anyone has mentioned this before. I have just downloaded and compiled 1.13.8 for the first time. And I try it: Run Wesnoth. Click multiplayer button. Click on the text area for username and a tool tip appears. The tool tip blocks the whole text area and I can't see what I type......
- October 17th, 2017, 5:47 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutines
This works: local old_report_countdown = wesnoth.theme_items.report_countdown old_time = os.clock() function wesnoth.theme_items.report_countdown() new_time = os.clock() if new_time - old_time > 1.0 then old_time = new_time wesnoth.message(new_time) end return old_report_countdown() end What if one ...
- October 17th, 2017, 4:51 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutines
The wesnoth while loop idea doesn't work. The game freezes for a while and then gives up on running the while loop. I guess this means wesnoth doesn't listen to user input when it runs the while loop. I was reading the Tetris source code, which creates four special units. Whenever the player's curso...
- October 17th, 2017, 1:08 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutines
I tried os.time() in lua on linux, and it works for 1.12. I don't know if that works on windows.
Code: Select all
wesnoth.message(os.time())
- October 16th, 2017, 6:51 pm
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Re: Coroutines
The thing is, it can't recognize "coroutine". Not "coroutine.yield()", not "coroutine.create(...)". The lua script can't even execute in wesnoth. Is it possible to ask lua do something (like wait x seconds before changing a label) while wesnoth can still listen to user ...
- October 16th, 2017, 7:51 am
- Forum: Lua Labs
- Topic: Coroutine / Schedule Lua code without freezing Wesnoth
- Replies: 14
- Views: 8167
Coroutine / Schedule Lua code without freezing Wesnoth
How to use coroutines included in multiplayer scenario? I tried: local helper = wesnoth.require("lua/helper.lua") function cotest() while 1 do os.execute("sleep " .. tonumber(0.2)) end coroutine.yield() end co = coroutine.create(cotest) [/code] I get lua error: attempt to index g...
- October 16th, 2017, 3:43 am
- Forum: WML Workshop
- Topic: I have a big issue with the map editor, help please!
- Replies: 4
- Views: 1988
Re: I have a big issue with the map editor, help please!
You can open scenario by choosing load maps, click "..", click "scenarios", and then choose "<name of your scenario>.cfg"
The links at https://wiki.wesnoth.org/Create might help if you want to make a multiplayer scenario.
The links at https://wiki.wesnoth.org/Create might help if you want to make a multiplayer scenario.
- October 16th, 2017, 2:25 am
- Forum: WML Workshop
- Topic: Using relative paths in quotes
- Replies: 3
- Views: 1326
Re: Quoted path containing macros
Thanks, Ravana. I changed all includes to: {./<relative Path>} It seems that something like this in "scenario/main.cfg" works: map_data="{LD maps/map0.map}" Setting variable doesn't work: in main.cfg: [set_variable] name=scenario_name value="Blank_MP_Scenario" [/set_var...
- October 16th, 2017, 2:03 am
- Forum: WML Workshop
- Topic: Using relative paths in quotes
- Replies: 3
- Views: 1326
Using relative paths in quotes
Hi. I try to make a template for a multiplayer campaign for testing scripts. I want to make renaming the campaign as easy as possible. So, I try to use macros. But I can't quite figure out if it is ok to use macro within quotes. If I can use relative paths for everything instead of using macros, it ...