A question for the Lua lovers

(previously 'DEVELOPER') Private forum for registered community members. To register, please visit www.prison-architect.com/register.

Moderator: NBJeff

User avatar
paktsardines
level5
level5
Posts: 1752
Joined: Mon Oct 01, 2012 11:10 am
Location: Australia

A question for the Lua lovers

Postby paktsardines » Fri Nov 09, 2012 11:08 am

I'm have a bit of an idea for a grant mod to add some functionality that's not available yet, but which will likely available in the future.

The problem I'm having is that I'd like a grant to be rewarded automatically when n days have passed (or similar interval that scales with the game speed).

I know how to set objectives for grants that depend on rooms, objects, staff. Does anyone know how to set an objective based on a timer elapsing?

Grateful for any advice.
User avatar
ronanc
level4
level4
Posts: 563
Joined: Wed Sep 26, 2012 2:56 pm
Location: Vietnam

Postby ronanc » Fri Nov 09, 2012 11:11 am

Ahhh now this would actually be quite cool. Not sure if it's possible to do yet but I can see it adding a lot to the game.
Causeless
level2
level2
Posts: 166
Joined: Fri Sep 28, 2012 11:49 pm

Postby Causeless » Fri Nov 09, 2012 11:23 am

Hmm, this isn't a general lua question. It'd need to be some sort of function telling the in-game time, if you wanted it not to be extremely hacky.
User avatar
ronanc
level4
level4
Posts: 563
Joined: Wed Sep 26, 2012 2:56 pm
Location: Vietnam

Postby ronanc » Fri Nov 09, 2012 11:30 am

Causeless wrote:Hmm, this isn't a general lua question. It'd need to be some sort of function telling the in-game time, if you wanted it not to be extremely hacky.



Fair enough, but this would be a great addition to the Lua side of things. Right now you can have a grant pay up when you start it and/or when you complete it. Having it pay up after X hours would be cool too.
User avatar
paktsardines
level5
level5
Posts: 1752
Joined: Mon Oct 01, 2012 11:10 am
Location: Australia

Postby paktsardines » Fri Nov 09, 2012 11:33 am

Hmm, this isn't a general lua question. It'd need to be some sort of function telling the in-game time, if you wanted it not to be extremely hacky.

Exactly. I could just use some sort of lua timer fuction, but then it wouldn't scale with game speed.


And just to clarify, instead of 'n days from now' I should have said 'at the start of the nth day from now', so that the grant is obtained along with the daily cash intake.
User avatar
paktsardines
level5
level5
Posts: 1752
Joined: Mon Oct 01, 2012 11:10 am
Location: Australia

Postby paktsardines » Fri Nov 09, 2012 12:20 pm

Ah, I see there's TimeIndex and TimeScale properties saved in a .prison file. I'm guessing TimeIndex is intervals (seconds?) elapsed since time 0.

Any idea how I'd use lua to access its value? Something like: now_time=Game.TimeIndex ?
Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Postby Mas Tnega » Fri Nov 09, 2012 1:37 pm

There's no example of any such thing being used in the existing scripts so your guess is as good as anyone else's.

Return to “Community Members”

Who is online

Users browsing this forum: No registered users and 12 guests