Jump to content

Overwrite Config Settings


Cyrem
 Share

Recommended Posts

As you would know if you wanted to change something in the CFG you would just find the setting and change it. However you can overwrite those settings just by adding the new modified lines to the CFG. What do I mean? Open your Lego.cfg file, scroll right to the bottom and paste this:


Lego* { ; Change loading text mod

Main {

LoadingText Test

}

}
Now when you run the game you will see how this overwrote the previous settings. Now, paste this next code after it again:

Lego* { ; Don't play the avi intro mod

Main {

DontPlayAvis TRUE

}

}

Again, it will overwrite. It will show the 'test' loading text and won't play the AVI's. Disabling a mod is just as easy, all you have to do is put a ";" or some other random text before "Lego*" and the mod will be disabled. What does this mean? It means modding the cfg can be so much easier! when making mods you can just write in the stuff that needs to be changed and all the user has to do is copy and paste it at the end of the cfg. You'll no longer need to look for certain lines to change.

Link to comment
Share on other sites

A very good find!

But it will take some time to edit all posts to allow this.

Shouldn't take that long.


I have found a problem so far sadly. If I insert the stats section and change one variable etc... it will crash the game, I have figure out why though. If that object/vehicle/unit is being used it tries to look for it's stats section(which doesn't exist). However I have found that all I have to do to not crash the game is define the sections in the stats (so like only put in "LaserShot {}" ) and the game will run fine. You will only have to do this in the sections you are editing if there are sub-sections(So if you don't need to mod the stats you don't need to worry about that section).

Link to comment
Share on other sites

it is a nice find. however, i did notice slightly longer load times. i fear that with a heavily moded cfg file could severly hurt load times.

Link to comment
Share on other sites

it is a nice find. however, i did notice slightly longer load times. i fear that with a heavily moded cfg file could severly hurt load times.

The game generates it's engine when the game starts. This is the reason the game takes a little while to load initially.

Now about the slower load time, I didn't notice any slow down on my machine even when pasting the whole cfg twice. Also would you rather have a faster load time, but spend longer modding the game? or would you rather wait the extra few seconds that it may take but the way you mod becomes twice as easy and having the ability to enable/disable mods by inserting one character. I think I'd rather wait the extra seconds.

EDIT: Furthering my previous reply, for example this won't crash the game:


Stats {

Pilot {

UseLegoManTeleporter FALSE
}

RockMonster {}
SmallSpider {}
Bat {}
TinyRM {}
TinyIM {}
Slug {}
LavaMonster {}
IceMonster {}
Hoverboard {}
SmallHeli {}
Smallmlp {}
SmallCat {}
SmallDigger {}
SmallTruck {}
Bulldozer {}
WalkerDigger {}
LargeDigger {}
LargeCat {}
LargeHeli {}
LargeMLP {}
Barracks {}
Powerstation {}
OreRefinery {}
TeleportPad {}
TeleportBIG {}
Docks {}
Toolstation {}
GunStation {}
Geo-dome {}
Upgrade {}
PowerCrystal {}
ProcessedOre {}
Ore {}
Boulder {}
Pusher {}
Freezer {}
LaserShot {}
ElectricFence {}
Path {}

}

Link to comment
Share on other sites

Hm, now that I've thought a little more about it, I think it is only advantageous for those installing the mods. Not the ones making it. (Searching, copying the line and the section start and end markers)

Also with PSPad you can make 9 or 10 bookmarks that refer to a certain line. I have been using that feature to make it easier for me to find sections.

But if you are converting everything, I don't have any complaints ;) .

Link to comment
Share on other sites

Hm, now that I've thought a little more about it, I think it is only advantageous for those installing the mods. Not the ones making it. (Searching, copying the line and the section start and end markers)

Also with PSPad you can make 9 or 10 bookmarks that refer to a certain line. I have been using that feature to make it easier for me to find sections.

But if you are converting everything, I don't have any complaints ;) .

Well here is the first mod using that system: . Check that out and test it if you wish.

Link to comment
Share on other sites

...I dont get it. This is way more complicated than the topic way. And why did you delete that poll?

I think Im going to stick to searching for the line...

Link to comment
Share on other sites

...I dont get it. This is way more complicated than the topic way. And why did you delete that poll?

Poll, changed my mind. This is a different topic anyway.

This method is twice as easy. All you have to do is paste the code at the end of the configuration file and that's it, save and run the game. It allows you to easily see all the mods that have been installed because they are all at the end.

Try it before judging.

Link to comment
Share on other sites

  • 1 month later...

Cyrem, I want to make the cfg modder use this. Can you maybe elaborate a bit. My head is spinning...

Or can somebody explain it to me in a pm?

Link to comment
Share on other sites

Cyrem, I want to make the cfg modder use this. Can you maybe elaborate a bit. My head is spinning...

Or can somebody explain it to me in a pm?

For an automatically modded CFG, I think it would be best to modify the original sections.

Link to comment
Share on other sites

I was hoping for something else...

It's harder to do it that way with the program. I want it to just append it to the end of the files, it will be a lot simpler in code terms, for it won't need to use a complicated search function.

Any help cyrem?

Link to comment
Share on other sites

I was hoping for something else...

It's harder to do it that way with the program. I want it to just append it to the end of the files, it will be a lot simpler in code terms, for it won't need to use a complicated search function.

Any help cyrem?

Yes, this way you can easily see the changes the program has made and you can manually remove them easily if necessary.

Addict, I have pretty much explained everything in the posts in this topic. But here is a summary

- For every mod you need to have:


Lego* {

;mod stuff in here.

}
- Anything in here will overwrite the settings in the previous "Lego" settings block. So if you install many mods in this new way that alter the same variable, the last variable value set will not be overwritten. - You can add as many "Lego" blocks as you want (to my knowledge). I recommend 1 for each mod. - If you are altering a sub-sub block, you need to reconstruct the sub-sub block's parent block. If you don't understand look at this:

Stats {

Pilot {

UseLegoManTeleporter FALSE
}

RockMonster {}
SmallSpider {}
Bat {}
TinyRM {}
TinyIM {}
Slug {}
LavaMonster {}
IceMonster {}
Hoverboard {}
SmallHeli {}
Smallmlp {}
SmallCat {}
SmallDigger {}
SmallTruck {}
Bulldozer {}
WalkerDigger {}
LargeDigger {}
LargeCat {}
LargeHeli {}
LargeMLP {}
Barracks {}
Powerstation {}
OreRefinery {}
TeleportPad {}
TeleportBIG {}
Docks {}
Toolstation {}
GunStation {}
Geo-dome {}
Upgrade {}
PowerCrystal {}
ProcessedOre {}
Ore {}
Boulder {}
Pusher {}
Freezer {}
LaserShot {}
ElectricFence {}
Path {}

}

If you don't the game will crash.

I think that's pretty much it.

Link to comment
Share on other sites

I was hoping for something else...

It's harder to do it that way with the program. I want it to just append it to the end of the files, it will be a lot simpler in code terms, for it won't need to use a complicated search function.

You will need a search function to make it remove/deactivate the mods though... I think.

Why bother using a CFG modder if you'll have to remove the mods manually anyway? >_>

Link to comment
Share on other sites

Well to my mind you this is really helpful for creating such an automatic modding tool because you can easily modify the values of the game by accessing the lines.

@addictgamer

If you program it in C++ or C# I can give you some advises.

When you open or access the cfg file with your app you can easily program an initialize function which scans the file and lines it up. So you can access the values either by searching for the specific string in the file or by asking the line number.

Link to comment
Share on other sites

Thats what it's been doing.

BUT, I can't figure out how to make it say, ok, from here to here is pilot's properties. everything I try returns errors.

Link to comment
Share on other sites

specify the lines. Lines 199 to 256 are the Pilot settings.

Concept:

Array Line 199 to 256

Go Line 200 , get String, put string in your variable and edit your variable

Link to comment
Share on other sites

Well, not if you put in an extra arg in another section before that one. Line numbers wont work. If you add Crosslava, thats an extra line, throwing off everything else under it. You need a way to identify the "Pilot {" part of the cfg, and end it at the last }. You need to have it look at { } as parameters.

Link to comment
Share on other sites

In case adding line you can also add a function reindex lines by adding (amout of new Lines) -> compare before after. That would be the easy way.

Other way of indexing the file is creating search tables which include the Setting Tables etc. but this is far more complicated.

Link to comment
Share on other sites

  • 2 weeks later...

Well, I hate the c++ file i/o and string operations. And there are no good libraries that do what I speak of.

And, using a search for "pilot {" is what my current dev version sitting my hd does, only it isn't reliable...

So, I think it would be easiest just to have it append to the end of the cfg in the correct format, then I just declare the file object with "std::app" as a parameter.

But, I don't understand the way appending mods to the end of the cfg so that the game automatically adds it works.

Link to comment
Share on other sites

  • 2 weeks later...

Well if I have more time (and I think this will happen by the end of February) I could give it a try and see wheter I can build up something to simplify this.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.