Export Scheme/Weapons settings

12 replies [Last post]
Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

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!

nemo
nemo's picture
User offline. Last seen 24 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

It would be a good thing to add. patches welcome etc Smile

Right now it does have to be done in a text editor.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

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 ...

function GreetHogs()
	-- Greet players
  if (TotalRounds > 0) then
    HogSay(CurrentHedgehog, "Blah", SAY_SHOUT) 
  end
  if (TotalRounds > 1) then
    HogSay(CurrentHedgehog, "BlahBlah", SAY_THINK) 
  end
  
end

*) 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

nemo
nemo's picture
User offline. Last seen 24 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

Hoot allegedly wrote:

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)

Try setting TemplateFilter in onGameInit to 2

Hoot allegedly wrote:

b. Bouncy Walls, is there?

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.

Hoot allegedly wrote:

c. And while we are on it:

Where lies the error in these lines ...

function GreetHogs()
	-- Greet players
  if (TotalRounds > 0) then
    HogSay(CurrentHedgehog, "Blah", SAY_SHOUT) 
  end
  if (TotalRounds > 1) then
    HogSay(CurrentHedgehog, "BlahBlah", SAY_THINK) 
  end
  
end


I dunno. Seems fine? what's the problem?

Hoot allegedly wrote:

*) 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

I have no idea what this is.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

Great nemo, I will try that!

nemo allegedly wrote:

I dunno. Seems fine? what's the problem?

Well, my hogs stay quiet ... they should speak/think at rounds 1 and 2.

nemo allegedly wrote:

Hoot allegedly wrote:

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

I have no idea what this is.


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?

nemo
nemo's picture
User offline. Last seen 24 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

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

Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

Oops. Right.

Called at
function onGameStart()
GreetHogs()

end

nemo
nemo's picture
User offline. Last seen 24 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

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

Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

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!

nemo
nemo's picture
User offline. Last seen 24 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

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

Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

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.

nemo
nemo's picture
User offline. Last seen 24 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

Hoot allegedly wrote:

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.

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

Hoot
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 2013-12-14
Posts: 51

nemo allegedly wrote:

Colour is RGB, which is increasingly well recognised today

Ow. How depressing. Was automatically thinking of some special color coding instead of such a simple and straightforward solution ... Stopping to ask questions ...

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]