Search found 627 matches
- January 11th, 2014, 1:20 pm
- Forum: Lua Labs
- Topic: Converting a unit to a lua table?
- Replies: 7
- Views: 3982
Re: Converting a unit to a lua table?
Well, here's my solution now. The downside is that I now need to make sure my recall slave side's recall list is cleared whenever the side is actually used in combat. local recall_slave_side = 3 function helper.create_stored_unit(unit_table) local lastIndex = savegame.lastUnitIndex or 0 unit_table.i...
- January 11th, 2014, 12:59 pm
- Forum: Lua Labs
- Topic: Converting a unit to a lua table?
- Replies: 7
- Views: 3982
Re: Converting a unit to a lua table?
To store a unit, use simply u = wesnoth.get_units( filter )[1] (saves the first unit that matched the filter). To convert it into a proper lua table, call its __cfg field, something like u = u.__cfg . You can join the two together as u = wesnoth.get_units( filter )[1].__cfg . I have no experience w...
- January 11th, 2014, 12:28 pm
- Forum: Lua Labs
- Topic: Converting a unit to a lua table?
- Replies: 7
- Views: 3982
Re: Converting a unit to a lua table?
Hm, with the store_unit method I'm still running into the problem of it trying to store translatable text which seems to be a userdata rather than a lua table that can be simply translated back and forth with get_variable/set_variable. Meh. Might have to use a huge list of units and store units as i...
- January 11th, 2014, 12:00 pm
- Forum: Lua Labs
- Topic: Converting a unit to a lua table?
- Replies: 7
- Views: 3982
Converting a unit to a lua table?
I'm working on a campaign written almost entirely in lua, and so having data available as pure lua tables is very useful. However, they should be pure lua tables, not userdata, since I also use lua table serialization for my "savegames". It seems that wesnoth.copy_unit might do this, but I...
- January 19th, 2013, 5:48 pm
- Forum: Lua Labs
- Topic: Creating translatable strings
- Replies: 7
- Views: 2877
Re: Creating translatable strings
Okay, I tried to make life simple on me, but it backfired: -- custom textdomain function that'll return a translator that -- does variable substitution as well as translation helper.textdomain = function(domain) local translator = wesnoth.textdomain(domain) return function(str) return tostring(trans...
- January 19th, 2013, 5:18 pm
- Forum: Lua Labs
- Topic: Creating translatable strings
- Replies: 7
- Views: 2877
Re: Creating translatable strings
What about this? bar = "..." s = tostring(_ "foo {bar} baz"): gsub("{([^{}]+)}", _ENV) It won’t work for WML variables though. It may work for WML variables (and only WML variables) if you replace _ENV with the WML variable metatable, but why use WML variables in Lua? ...
- January 19th, 2013, 3:57 pm
- Forum: Lua Labs
- Topic: Creating translatable strings
- Replies: 7
- Views: 2877
Creating translatable strings
I'm not sure how to do this. Obviously: "foo" .. bar .. "baz" is not going to work Given that V is a WML variable metatable, I tried: V.bar = bar V.message = _ "foo $bar baz" But oddly, this doesn't seem to do variable substitution immediately, which will cause strings ...
- December 28th, 2009, 7:57 am
- Forum: Multiplayer Development
- Topic: Conquest 1.0 - Now on the 1.6 Add-on Server
- Replies: 184
- Views: 33853
Re: Conquest 1.0 - Now on the 1.6 Add-on Server
So sorry it took a while, I installed windows and malware as it is, it crushed my GRUB(I think I should let GRUB have a few kills so it can level). Anyway, uploading the bug fixes.
- December 27th, 2009, 8:09 pm
- Forum: Multiplayer Development
- Topic: Conquest 1.0 - Now on the 1.6 Add-on Server
- Replies: 184
- Views: 33853
Re: Conquest 1.0 - Now on the 1.6 Add-on Server
Thanks for the feedback. 2. Some units have xp 1000 and some 32. Fixed. 3. If fog is selected, first turn too should have fog. And they should be able to see their units. Purpose of fog is defeated when 1st turn is not fog. Alright, done. 4. Moving on first turn should be limited to 1, even if all v...
- December 27th, 2009, 9:08 am
- Forum: Multiplayer Development
- Topic: Conquest 1.0 - Now on the 1.6 Add-on Server
- Replies: 184
- Views: 33853
Re: Conquest 1.0 - Now on the 1.6 Add-on Server
I have worked some more on Conquest, changes include: - polishing up of the WML, packing redundant code into macros - moving of the general conquest WML into another file, making it easier to create new conquest maps - a game setup dialogue for player one, making it possible to select the amount of ...
- December 27th, 2009, 12:57 am
- Forum: WML Workshop
- Topic: Error in WML
- Replies: 37
- Views: 3846
Re: Error in WML
Look up http://wiki.wesnoth.org/EffectWML.
You have to add the special with an [effect], applying it to the unit through an [object].
You have to add the special with an [effect], applying it to the unit through an [object].
- December 26th, 2009, 11:40 pm
- Forum: Game Development
- Topic: Wesnoth Online World?
- Replies: 94
- Views: 22891
Re: Wesnoth Online World?
Hm.. It seems you know quite well what you are doing. I would like to help, but along with Java, PHP and Javascript are on my list of languages I never want to use again. I probably can help with the design and mechanics though(I know very well how Wesnoth works in that regard). By the way, I'm real...
- December 26th, 2009, 6:57 am
- Forum: Game Development
- Topic: Wesnoth Online World?
- Replies: 94
- Views: 22891
Re: Wesnoth Online World?
I use firefox, it's still laggy :p I think scrolling and so won't become smooth without a proper renderer.
- December 25th, 2009, 11:34 pm
- Forum: Game Development
- Topic: Wesnoth Online World?
- Replies: 94
- Views: 22891
Re: Wesnoth Online World?
Hm, this looks quite impressing. However, I'm not sure whether using a browser is the best idea. It gets quite "laggy".
- December 25th, 2009, 5:16 am
- Forum: Multiplayer Development
- Topic: Conquest 1.0 - Now on the 1.6 Add-on Server
- Replies: 184
- Views: 33853
Re: Conquest 1.0 - Now on the 1.6 Add-on Server
I've done some changes and optimization to conquest Europe, including infantry spawns on all 60 villages(the number of villages can be adjusted by editing a simple number and is spread out equally among the players).
Note: Accidentally uploaded an old version, new one is up now.
Note: Accidentally uploaded an old version, new one is up now.