Patch to allow use of lua scripts in lobby games

Patch to allow use of lua scripts in lobby games

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Patch to allow use of lua scripts in lobby games

Post by hughperkins »

Here's a patch to read a value "scriptname" from the lobby-generated script.txt file:

http://manageddreams.com/csai/startscript.diff

This means you can specify arbitrary start script for lobby-generated games, opening up the possibility for multiplayer missions, and Use Map Settings type games.

How do I go about incorporating this into the Spring core?
Last edited by hughperkins on 11 Nov 2006, 06:50, edited 1 time in total.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Note that here is a sample valid script.txt and lua script:

Save this to your spring application directory, taspring:

http://manageddreams.com/csai/script.txt

Save this to taspring/startscripts:

http://manageddreams.com/csai/lobbymissiontest.lua

Then just run:

spring.exe script.txt
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Post by ILMTitan »

To get you code applied to the core:

Step 1: Creates a Patch file using subversion (or the subversion client you are using)

Step 2:
Option 1: Submit a bug to manits (the Bug tracker link at the top of this page) and include the patch file and a description of the patch. The devs will post comments for any changes they would like/need you to make. Submit new patches to the same bug until they are satisfied.
Option 2: Email the patch to the mailing list.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Code: Select all

+     
+ 	scriptName=file.SGetValueDef("","GAME\\scriptname");
+     if(scriptName.empty())
+     {
+         scriptName = "Commanders";
+     }
Should be:

Code: Select all

+ 	scriptName=file.SGetValueDef("Commanders","GAME\\scriptname");
Also, could you supply a unified diff, I don't recognize this one (what do the exclamation marks mean?). (sorry if someone else already told you so through another medium)
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Ok, corrected these two issues:

http://manageddreams.com/csai/startscript.diff
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

Coolness. :-)
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post by hughperkins »

Committed to SVN.
Post Reply

Return to “Engine”