Search found 115 matches

by Luther
March 1st, 2011, 5:09 pm
Forum: Lua Labs
Topic: [set_variables] doesn't seem to do anything
Replies: 4
Views: 1535

Re: [set_variables] doesn't seem to do anything

You seem to be using the helper.set_metatables stuff which always confuses me so I don't quite understand Supposedly, 'V[v]' should return the same thing as 'wesnoth.get_variable(v)', but that doesn't seem to be the case for tables (see below). BTW, I couldn't find dbms in wlp. Is it only in the 1....
by Luther
March 1st, 2011, 12:34 am
Forum: Lua Labs
Topic: [set_variables] doesn't seem to do anything
Replies: 4
Views: 1535

[set_variables] doesn't seem to do anything

I'm looking for a way to feed raw WML files into Lua so I can extract data from them, but no matter what I do, I can't get [set_variables] to actually store any data. The following code is in a testing state to show exactly what doesn't work. Here's my WML: [event] name=prestart [set_variables] name...
by Luther
February 28th, 2011, 7:23 pm
Forum: Lua Labs
Topic: loading WML from a file into a table
Replies: 7
Views: 2345

Re: loading WML from a file into a table

As far as I know, there's no way to store an image in a variable. What are you trying to do, exactly?
by Luther
January 22nd, 2011, 6:12 pm
Forum: Lua Labs
Topic: monochromatic's lua thread
Replies: 42
Views: 9502

Re: elvish_sovereign and Lua

Ninja'd, but this might make it more clear. :) You'll need to combine type= and side= with unit_wml to make a single table. local unit_wml = helper.get_child( cfg, "unit_modifications" ) or {} unit_wml.side = cfg.side --Then, inside the loop: unit_wml.type = helper.rand(cfg.type) wesnoth.p...
by Luther
January 22nd, 2011, 7:41 am
Forum: Lua Labs
Topic: Luther's Lua Pack (1.8) / Lua Globals (1.9.4)
Replies: 0
Views: 1898

Luther's Lua Pack (1.8) / Lua Globals (1.9.4)

I have a file, called 'globals.lua', that I've been using to contain all the boilerplate that I believe should go at the top of every Wesnoth Lua file. From reading this forum, it seems there are a lot of new Lua coders who are starting themselves off by making content for Wesnoth 1.9. I think my fi...
by Luther
January 21st, 2011, 7:16 pm
Forum: Lua Labs
Topic: monochromatic's lua thread
Replies: 42
Views: 9502

Re: elvish_sovereign and Lua

1. You seem to be using some unnecessary quotes. It's OK to quote WML variables, since they're not related to Lua syntax, but Lua variable names should never be quoted. 2. Change this: local rand_position = helper.rand("1..#possible_locations") to this: local rand_position = helper.rand('1...
by Luther
January 12th, 2011, 9:59 pm
Forum: Scenario & Campaign Development
Topic: Fire-Forged Friends
Replies: 164
Views: 27585

Re: Fire-Forged Friends

I still can't see it there. What version of Wesnoth are you running? Also tell me the exact title (from the .pbl file) and directory name. (Maybe I'm just not searching properly.) EDIT: I found it on the page for the trunk server. You must be using an svn checkout. I use Wesnoth 1.8.5, so if I do up...
by Luther
January 12th, 2011, 8:39 pm
Forum: Scenario & Campaign Development
Topic: Fire-Forged Friends
Replies: 164
Views: 27585

Re: Fire-Forged Friends

I couldn't find it for any Wesnoth version on http://addons.wesnoth.org.The instructions for uploading add-ons are here: Distributing_content#The_Add-on_Server

Please let us know if you need any help.
by Luther
January 12th, 2011, 3:02 pm
Forum: Scenario & Campaign Development
Topic: Fire-Forged Friends
Replies: 164
Views: 27585

Re: Fire-Forged Friends

I think it would really help if you upload everything you have to the add-on server, including the maps. Coders need to be able to see the work that's been done so far before they'll get interested. If it hasn't been updated for Wesnoth 1.8, put a warning to that effect in the description.
by Luther
January 10th, 2011, 10:45 pm
Forum: Lua Labs
Topic: monochromatic's lua thread
Replies: 42
Views: 9502

Re: elvish_soveriegn and Lua

1. What exactly is the difference between a normal global variable local global variable? (I know that if the local is within a block, it will just be applicable to that block.) I've read local ones are faster, since they are indexed. I'll sometimes see in the code that some global variables are lo...
by Luther
January 1st, 2011, 5:01 pm
Forum: Lua Labs
Topic: Getting started with LUA
Replies: 10
Views: 3101

Re: Getting started with LUA

It looks like you don't have W defined. Try something like: W = wesnoth.wml_actions EDIT: Also, you probably shouldn't have a return statement inside a table. If it's not a syntax error, it will exit the function without executing any code after it. Another thing: 'rob = yes' doesn't make much sense...
by Luther
December 6th, 2010, 5:15 am
Forum: Lua Labs
Topic: Dixie's Lua Thread
Replies: 81
Views: 12611

Re: Dixie's Lua Thread

Not quite. set_wml_tag_metatable is a shortcut for writing subtags within a WML table. IMO, if you break lines at the right places and indent, this makes it look more like real WML. wesnoth.fire simply executes an action tag. Action tags are those found at these pages: DirectActionsWML , InterfaceAc...
by Luther
December 6th, 2010, 1:04 am
Forum: Lua Labs
Topic: Dixie's Lua Thread
Replies: 81
Views: 12611

Re: Dixie's Lua Thread

Dixie wrote: The faulty line being : T.not { id = start.id }
That particular line won't work because 'not' is a reserved word. As in "if not some_boolean then...". Change the "T.not" to "T['not']" and you should be fine.
by Luther
November 30th, 2010, 4:07 pm
Forum: Lua Labs
Topic: Elvish_Hunter's Lua thread
Replies: 170
Views: 31953

Re: Elvish_Hunter's Lua thread

Alternatively, I can try to use both math.ceil and math.floor in some way, but of course I haven't tested yet. I wonder why Lua doesn't have also a math.round function. :?: I think the Lua people expect you to use a string format. In other words, convert to a string, which rounds off, then back to ...
by Luther
November 25th, 2010, 5:37 pm
Forum: Lua Labs
Topic: Elvish_Hunter's Lua thread
Replies: 170
Views: 31953

Re: Elvish_Hunter's Lua thread

Suggestion: [harm_unit] should take a fire_event= key and pass it directly (without even looking at it, for consistency) to [kill]. The reason [kill] has this key is because $x1 and $y1 are global and can be overwritten by other events. If fire_event=true by default, then the user loses control of t...