Export Scheme/Weapons settings
Sun, 2014-07-20 17:38
Hello,
I most probably missed the answer to this one, so sorry for asking:
Is there a way to export specific Scheme and Weapons settings (like one named "littletourney"), for example to share them with others for a mini-tournament? So that they don't have to adjust all the settings when they host a game for an opponent?
And if so, can the customized setting via the Settings screen be exported somehow or has it to be written line by line as code, as it is done with the main Styles?
Thanks for helping!
It would be a good thing to add. patches welcome etc
Right now it does have to be done in a text editor.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Just curious: Is there some raw "default template" around for creating a weapon/scheme set (ie, style)?
So a document where all defaults are set plus all the other weapons and options are included, so one can just discard what is not needed and adjust the rest?
That is, a bit like the HW LUA guide ( https://code.google.com/p/hedgewars/wiki/LuaAPI ) but encased in a working mission code.*
Not an urgent issue, might just be helpful for those who code one now and then.
Then three other things: There is no way yet to script
a. the size of the map (so that always a "Medium" map has to be used for example, but Theme and map itself is random)
b. Bouncy Walls, is there?
c. And while we are on it:
Where lies the error in these lines ...
*) a key to this (ceratinly already somewhere around?) would also save decyphering time -- I of course know what it means but it takes long every time I start to figure out the precise types again:
G,C,B,B,S,M,D,D,F,W,P,B,M,C,S,W,H,D,B,R,S,M,B,G,F,S,K
1,1,1,2,1,1,1,2,1,1,1,2,1,3,1,3,3,2,3,3,1,1,2,1,2,2,1
| BRW Touchy Barrels :: Snowstorm — get a frosty burial | What is Jugger? Video
Try setting TemplateFilter in onGameInit to 2
No pretty API fashion, but the game engine and frontend communicate w/ short english phrases that are exposed to Lua. The only trick is the arguments aren't always ascii, since it was often more convenient to not do a conversion.
https://code.google.com/p/hedgewars/wiki/LuaDrawing makes use of this
Anyway, for WorldEdge, the command is worldedge and the parameter is an integer. The types are also not exposed to lua so you can't use the engine pretty names, but…
ParseCommand('worldedge '..string.char(2)) should work. Actually… I think the way it is set right now, you can change it at any point mid-game.
I dunno. Seems fine? what's the problem?
I have no idea what this is.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Great nemo, I will try that!
Well, my hogs stay quiet ... they should speak/think at rounds 1 and 2.
The local weapons_values.
Oh, I think I included the abbreviations myself (or not? can't remember, long ago) to have a guide which number stands for which gear and what it actually means ... even with that it take tiiime to figure out the meanings again.
But now I start to remember that this might have been just some special setting for BRW. No worries then.
As for the ParseCommand, I throw that just into the code as
function ParseCommand('worldedge '..string.char(2))
end
... right?
| BRW Touchy Barrels :: Snowstorm — get a frosty burial | What is Jugger? Video
erm. you're calling it, so you wouldn't say "function" - see the example code.
As for the hog speech thing, dunno… Can't think of any reason offhand.
Where are you calling GreetHogs?
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Oops. Right.
Called at
function onGameStart()
GreetHogs()
end
| BRW Touchy Barrels :: Snowstorm — get a frosty burial | What is Jugger? Video
So.. A fundamental thing about the game, is the lua is event driven. Think javascript.
We define callback points like onGameInit or onGameTick20 and you have to do something.
You can use the internal script state (flags you set or whatever) to determine whether something needs doing if you like, but your code is only called in one of the hooks…
Sooo, if you want the hogs to talk, try putting the call in onNewTurn.
Otherwise, the function gets called, but before either condition can possibly be true.
I'd suggest looking over some of the existing scripts already in the game, such as, oh, Highlander.
http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Scripts/Multiplayer/
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Thanks so much! I am new to lua but nonetheless love to configure things ... sorry for asking so much.
I did look through existing scripts but missed that point. I will do my best, thanks!
| BRW Touchy Barrels :: Snowstorm — get a frosty burial | What is Jugger? Video
No problem.
I suggest reading:
https://code.google.com/p/hedgewars/wiki/LuaGuide
If there's anything you think that guide could use, let us know.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Thanks, now it is working like a charm, after inserting the function right into onNewRound-Event (intead of calling GreetHogs).
As for the suggestions: I will keep my eyes open! Some first ideas:
More examples:
Some more code examples in the LUA guide would be very helpful (I felt those that are already there have been a great help).
And/Or: Example- / master file:
It is great to have a lua file base structure in the LUA guide. Maybe it could be extrended with some basic functions to visualize the way lua works; for example, pause play, letting an AI hog pop up at a certain point of time (round OR tick time),let him say something, let him shoot somewhere and let him vanish again, resume play. Something like that.
The thing with the finished LUAs is that the campaign files are crowded with code and cross-referencing, so a clear, short example file could be of great help.
Where's'what:
Adding a box with a list of pages concerning HW specific LUA coding and reference for easier navigation in all doc pages that are concerned with LUA (just like the links at the HW wiki pages).
One detail:
https://code.google.com/p/hedgewars/wiki/LuaGuide
AddTeam("Team", 14483456, "Simple", "Island", "Default")
Add a link to the color codes would be great.
| BRW Touchy Barrels :: Snowstorm — get a frosty burial | What is Jugger? Video
Well, maybe more the format than the codes.
Colour is RGB, which is increasingly well recognised today, esp by those w/ a bit of experience in HTML/CSS.
For example, if you had written 0xDD0000 instead of 14483456, I think most people would have immediately recognised it as a fairly bright red, give n that colours are from 00-FF.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Ow. How depressing. Was automatically thinking of some special color coding instead of such a simple and straightforward solution ... Stopping to ask questions ...
| BRW Touchy Barrels :: Snowstorm — get a frosty burial | What is Jugger? Video