Page 1 of 2

Changing the clock using an OXP

Posted: Mon Mar 26, 2007 3:27 pm
by Uncle Reno
Title says it all really. I want the clock to be advanced on by a couple of days when certain conditions are met but can't seem to find a way to do that, is it possible? I've found mention of ship_clock_adjust but can't get this to do anything for me.

Posted: Tue Mar 27, 2007 2:49 pm
by LittleBear
Commander McLane posted this script for a timer under the Black Monks thread:-

Code: Select all

 { 
               conditions = (  
                  "status_string equal STATUS_EXITING_WITCHSPACE", 
                  "mission_monks equal RUNNING" 
               ); 
               do = ( 
                  "set: mission_monks_checkdate [clock_days_number]", 
                  "subtract: mission_monks_checkdate [mission_monks_startdate]", 
                  { 
                     conditions = ( "mission_monks_checkdate greaterthan 6" ); 
                     do = ( 
                        "decrement: mission_monks_timer", 
                        "add: mission_monks_startdate 7", 
                        "add: mission_monks_loan 625" ); 
                        }, 
                     ); 
                  }
Havent tested it but I guess a:-

Code: Select all


increment: [clock_days_number] 2

or mabey an

add: [clock_days_number] 2

Would advance the clock by two days.

Not sure whether the variable needs to by in [ ] though.

Posted: Tue Mar 27, 2007 4:03 pm
by Commander McLane
I am not sure whether this works, too. Usually the system variables have special methods to set them, like "setLegalStatus: X", which cannot be replaced by "set: legalStatus_number X". The engine doesn't understand the latter syntax, which is however the normal syntax for setting mission_foo and local_foo variables. So I guess it wouldn't work for clock_days_number as well.

But this is only a guess. I would be interested in your testing results, Uncle Reno.

BTW: Do you remember where you have found the mentioning of ship_clock_adjust? I haven't come across that yet.

Posted: Tue Mar 27, 2007 8:16 pm
by Uncle Reno
Thanks for the replies LittleBear and Commander McLane.

I found the reference on this board in this post.

As Cmdr McLane suggested, the methods you put forward don't work LB;

Code: Select all

add: [clock_days_number] 2
gives the following info

Code: Select all

Oolite [script.debug.replaceVariablesInString]: EXPANSION: "clock_days_number" becomes "2084007"
Oolite [script.debug.note.scriptAction]: scriptAction after expansion: "add: 2084007 2"
Oolite [unclassified]: ***** CANNOT ADD: '2084007 2'
Oolite [unclassified]: ***** IDENTIFIER '2084007' DOES NOT BEGIN WITH 'mission_' or 'local_'
and

Code: Select all

increment: [clock_days_number] 2
returns

Code: Select all

Oolite [script.debug.note.scriptAction]: scriptAction: "increment: [clock_days_number] 2 "
Oolite [script.debug.replaceVariablesInString]: EXPANSION: "clock_days_number" becomes "2084007"
Oolite [script.debug.note.scriptAction]: scriptAction after expansion: "increment: 2084007 2"
which Oolite doesn't specifically object to but also doesn't do anything with.
Equally

Code: Select all

increment: [clock_days_number]
becomes

Code: Select all

Oolite [script.debug.note.scriptAction]: scriptAction: "increment: [clock_days_number]"
Oolite [script.debug.replaceVariablesInString]: EXPANSION: "clock_days_number" becomes "2084007"
Oolite [script.debug.note.scriptAction]: scriptAction after expansion: "increment: 2084007"
and again does nothing, all as correctly predicted by Cmdr McLane.

At the moment, I am assuming that it's not possible. :cry:

Posted: Tue Mar 27, 2007 8:33 pm
by LittleBear
Feared it might be so. Lots of Real World stuff going on ATM so no chance to test!

Posted: Tue Mar 27, 2007 8:35 pm
by Uncle Reno
LittleBear wrote:
Feared it might be so. Lots of Real World suff going on ATM so no chance to test!
No problem, thanks for your suggestions. :)

Posted: Tue Mar 27, 2007 9:12 pm
by TGHC
Well I put all my clocks forward at the weekend, without any problems. :wink:

Posted: Wed Mar 28, 2007 7:00 am
by Commander McLane
Thanks for the testing, Uncle Reno, and sorry that it didn't work out. Also thanks for the link, that suggests, that ship_clock_adjust is not a scripting method, but an engine command, coming from the decompiled code of the game itself, as far as I understand.

However I've posted a request for an adjustClock:-method in Ahrumans scripting requests-sticky, among a lot of other requests as well.

Posted: Wed Mar 28, 2007 7:46 am
by Uncle Reno
Commander McLane wrote:
Thanks for the testing, Uncle Reno, and sorry that it didn't work out. Also thanks for the link, that suggests, that ship_clock_adjust is not a scripting method, but an engine command, coming from the decompiled code of the game itself, as far as I understand.
No problem. I had a suspicion that it wouldn't work myself but given that I have been scripting (verrrrry sloooowly) for only 2 weeks I thought I'd see if anybody else had experience of this.
Commander McLane also wrote:
However I've posted a request for an adjustClock:-method in Ahrumans scripting requests-sticky, among a lot of other requests as well.
Excellent, thanks.

Posted: Wed Mar 28, 2007 7:48 am
by Uncle Reno
TGHC wrote:
Well I put all my clocks forward at the weekend, without any problems. :wink:
:lol:
I can't possibly describe how helpful you have been there, TGHC! :wink:

Posted: Wed Mar 28, 2007 9:09 am
by JensAyton
Commander McLane wrote:
However I've posted a request for an adjustClock:-method in Ahrumans scripting requests-sticky, among a lot of other requests as well.
…carefully ignoring the bit about not expressing your request in terms of specific method names for use with the old scripting model. :-)

Posted: Wed Mar 28, 2007 9:10 am
by TGHC
:D Always willing to help old chum :wink:

Seriously though your idea of clock adjusting could be a whole new facet of gamepaly, with timewarps and back to the future stuff, who knows if we ever get to land on planets we could be in Jurassic Park! or even find out when England finally win a footie match. (Well they're playing Andorra tonight apparently one of the weakest teams in the world, so they might scrape a draw or even score a goal!)

Posted: Wed Mar 28, 2007 9:29 am
by Commander McLane
Ahruman wrote:
Commander McLane wrote:
However I've posted a request for an adjustClock:-method in Ahrumans scripting requests-sticky, among a lot of other requests as well.
…carefully ignoring the bit about not expressing your request in terms of specific method names for use with the old scripting model. :-)
Oops, I didn't get that bit. Perhaps I didn't understand your opening post of that thread. I was honestly thinking you were asking for requests apart from the Java Script-thing as well.

So when I posted method-names together with an explanation what this method should do I felt completely in-line with this:
Ahruman wrote:
Please post specific requests for scripting functionality here, so we’ve got them in one place. Post a description of the desired method name, since a) a name that seems clear to you might not to me, and b) future scripting enhancements will primarily be for JavaScript.
Sorry if I'm not. :?

Posted: Wed Mar 28, 2007 10:45 am
by JensAyton
Does it say that? Damn. *fixes*

Posted: Fri Mar 30, 2007 8:30 pm
by Uncle Reno
OK, moving on (slightly) from changing the clock, I have noticed now that buying/selling goods takes exactly no time at all! Yes, you could load up your ship with a full 127 tonnes of Wine (for example) and it is immediately teleported on! :wink:
My vote would be for this to be changed at some point, after all, it takes 10 minutes for your ship to launch, whether you buy any goods or not.