question-circle Anybody left with POG scripting knowledge?

More
3 weeks 6 days ago #20722 by piratha
I want to create a simple list of text items to display in the GUI with a checkbox on the side and then pass this value to a function, that's all.

I'm somewhat put off from the almost zero usefull examples that come with the POG scripting reference, and the scarce quantity of source file around.

I already compiled my first ever .pkg and bound the activation to a key and it works! (including some output strings on the console).

I'm not that happy to run my code by launching the game, testing, closing, recompile, repackage and.. that would take forever! Does anybody have some code snippets to share? ;)

Please Log in or Create an account to join the conversation.

More
3 weeks 6 days ago #20724 by IronDuke
*raises hand*

Although my knowledge is primarily centered around coding activity/gameplay. :P I did try to do some UI coding once, but it wasn't easy. I feel you with the tiny amount of examples provided in the SDK, but you're in luck: there are already several mods that add additional UI and buttons to the game, and you can base your code off of them.
UniGUI is one of the best, considering that the others which I shall name all use it as a framework from which to branch out.
Future Trader may well be the single biggest; it adds full buying and selling of every commodity in the game when docked at random stations, although the specific stock available depends on the station, progress through the game, and friendliness to the station's faction. Lots of UI here!
Station Save is simple: it adds an option to UniGUI to let you save your game whenever docked to a station. It's a bit kludgy and bugs out easily, so I never used it much even though it's installed. Still, it's handy for an example.
There's one more mod called Station Assault which, while not really adding any UI of its own, builds on Future Trader and UniGUI, though it doesn't require either. It adds more gunstars to stations and lets you destroy said stations for cargo, then respawns them after a few hours. Hilarious fun! If you do install Future Trader, then you can buy gunstars for your own station, though they're never really useful since your base is never really attacked per se.

All the mods should come with full source. I just double-checked, and Future Trader does for sure. In fact, its entire source is in one file, which surprised me. :P Station Save is by GrandpaTrout, but the other three are all by Zazicle, so they play well together. Hopefully this all will be helpful. :)

The only way to really test out code is to launch the game and do the thing that you coded. :/ Unfortunately, I never figured out a better way to do it. Every change will need a recompile, and then firing up the game again since it won't register a change without a restart. I guess we're lucky modern PCs can start the game so fast. This was my biggest gripe when trying to code things, and was the biggest time-sink.

I-War 2 Discord: discord.gg/RWaabWB
Very little about the game is not known to me. Any questions you got, throw them at me. :)

Please Log in or Create an account to join the conversation.

More
3 weeks 6 days ago #20726 by piratha
Uhm I see. I'll try some, but after getting my script to work I lost the biggest part of the momentum - let's see!

Please Log in or Create an account to join the conversation.

More
2 weeks 3 days ago #20735 by piratha
I think I got it! last weekend I reworked the "FutureTrader" adding some usefull features and tweaked others. I also put together a personal MODpack.

I'm still thinkering around the economy system. I modified the interface a little bit:

_ when you dock to a station you'll see your faction factor: above 0.6 it's a friendly station
_ when you dock you can see the CHEP and the EXPENSIVE items offered by the station (easy to market)
_ in the top left list of goods' type will always be included the cheap and expensive item category; before it was not coded rendering free trading impossible
_ tweaked prices, added a 30% discount when dealing with friendly stations (basically you can buy cheap there)
_ added.. a get 10K Free CU button - finally an easy money cheat (!)

I'm still polishing them, need to write some changelog and come out with a name and credits where due :side:

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #20737 by IronDuke

piratha wrote: _ when you dock you can see the CHEP and the EXPENSIVE items offered by the station (easy to market)
_ in the top left list of goods' type will always be included the cheap and expensive item category; before it was not coded rendering free trading impossible

...hadn't thought of that. :whistle:

I-War 2 Discord: discord.gg/RWaabWB
Very little about the game is not known to me. Any questions you got, throw them at me. :)

Please Log in or Create an account to join the conversation.