Notifications
Clear all

To all SSC Station occupants

Thank you for the donations over the past year (2024), it is much appreciated. I am still trying to figure out how to migrate the forums to another community software (probably phpbb) but in the meantime I have updated the forum software to the latest version. SSC has been around a while so their is some very long time members here still using the site, thanks for making SSC home and sorry I haven't been as vocal as I should be in the forums I will try to improve my posting frequency.

Thank you again to all of the members that do take the time to donate a little, it helps keep this station functioning on the outer reaches of space.

-D1-

UncleBob's annoying API questions

Page 3 / 3
(@unclebob)
Estimable Member

Ah, so the parameter naming makes sense after all. Thanks for clearing that up!

I am a bit surprised to see a lower lawlessness in scarcely populated adjacent systems, in this case. Oh well, I guess smaller communities with tight seuritie would have less crime...

ReplyQuote
Topic starter Posted : January 7, 2012 01:22
(@brianetta)
Prominent Member

Smaller communities have less crime, period. Compare the inner city to any small village in the country. Crime becomes sustainable as a career option only when there's more opportunity (such as more potential victims).

ReplyQuote
Posted : January 7, 2012 04:16
(@unclebob)
Estimable Member
Quote:
NO_CENTRAL_GOVERNANCE has a base value of 1

hmmm... 12 Ophuchi has NO_CENTRAL_GOVERNANCE, but still gets a lawlessness of 0.04... Even with a few modifiers, that seems to be weird if it has a base value of 1.

ReplyQuote
Topic starter Posted : January 7, 2012 06:29
(@ziusudra)
Trusted Member

maxLawlessness would be a more accurate name than baseLawlessness. On Polit.cpp:225 a system's lawlessness is a random number between 0 and base.

It might make sense for that human_infestedness to be used to determine a minimum lawlessness.

ReplyQuote
Posted : January 7, 2012 08:37
 robn
(@robn)
Noble Member
Brianetta wrote:
Smaller communities have less crime, period. Compare the inner city to any small village in the country. Crime becomes sustainable as a career option only when there's more opportunity (such as more potential victims).

And/or less chance of being caught (more places to hide). Risk vs reward, as always.

ReplyQuote
Posted : January 7, 2012 13:10
 robn
(@robn)
Noble Member
Ziusudra wrote:
maxLawlessness would be a more accurate name than baseLawlessness. On Polit.cpp:225 a system's lawlessness is a random number between 0 and base.

It might make sense for that human_infestedness to be used to determine a minimum lawlessness.

At this time you shouldn't put much stock in anything related to politics, crime, economy or trade. Those are the "big four" that are intertwined in complex ways and haven't really been touched yet. They will change. You should still try things out and think about how it might work (we need insight in this area). Just don't get too hung up on any particular detail.

ReplyQuote
Posted : January 7, 2012 13:13
(@unclebob)
Estimable Member

I'm taking my code appart, putting the Infobrokers into their seperate LUA file, because otherwise things get a bit crowded. It'll also be easier to use InfoBrokers with other mission types should it become necessary in the future.

Anyways, that leaves me with the problem that I can't get direct access to the players mission list. There's Player:GetMission(), but how do I iterate through them without knowing how many there are? Does the function return nil when it's out of bound?

ReplyQuote
Topic starter Posted : January 8, 2012 08:52
(@brianetta)
Prominent Member
UncleBob wrote:
Anyways, that leaves me with the problem that I can't get direct access to the players mission list. There's Player:GetMission(), but how do I iterate through them without knowing how many there are? Does the function return nil when it's out of bound?

You cannot. If you don't track your missions yourself, you're pretty much stuffed. I cover the mission list from almost exactly half way down this wiki page.

ReplyQuote
Posted : January 8, 2012 10:52
(@unclebob)
Estimable Member

So there is no way for a LUA module to interact with missions created by another? Well, I guess I have to merge my InfoBrokers back into the same LUA file again, then... 🙁

ReplyQuote
Topic starter Posted : January 8, 2012 11:13
(@brianetta)
Prominent Member
UncleBob wrote:
So there is no way for a LUA module to interact with missions created by another? Well, I guess I have to merge my InfoBrokers back into the same LUA file again, then... 🙁

There's one way... abuse the global scope. )-:

ReplyQuote
Posted : January 8, 2012 11:29
(@brianetta)
Prominent Member

Expanding on that last:

The only Lua scripts that currently create globally scoped objects are the ones in data/libs, and that should probably remain the case. Scripts in that directory are executed before those in data/modules. Ideally, they should provide an API for module scripts to use. That API should be documented by means of the Codedoc system already used by those existing already.

The only ones that exist so far are Translate.lua and Characters.lua, the bulk of both of which I wrote myself. Neither of them do anything directly visible to the player. They each provide a class, with methods which the module scripts use.

ReplyQuote
Posted : January 8, 2012 11:35
 robn
(@robn)
Noble Member

Stuff under libs/ is considered part of the "core" API, just like Body, Ship, StarSystem and all those other things. The only difference is that they're written in Lua instead of C++.

If you have functionality that you think will be genuinely useful to multiple scripts, then its likely it belongs in libs/. Don't overthink it though. If you're only implementing one module then just do it there. We can split out that functionality later if its going to be useful.

ReplyQuote
Posted : January 8, 2012 12:04
(@unclebob)
Estimable Member

Sounds like it's really the smartest thing to put them together again. I'm not comfortable enough yet with LUA for messing around with core functionality. Thanks for the help.

ReplyQuote
Topic starter Posted : January 8, 2012 13:28
Page 3 / 3