New developer features.

General discussion about RailWorks, your thoughts, questions, news and views!

Moderator: Moderators

crazyfrogbro
Established Forum Member
Posts: 304
Joined: Tue Jan 18, 2011 9:09 pm

Re: New developer features.

Post by crazyfrogbro »

It is. I tried yesterday with filewrites (because the luadebug still not works). The file is risen by 5 kbyte/sec without touching any control key...
For rw2 i don't know i tried first with rw3.
Kariban
Very Active Forum Member
Posts: 4478
Joined: Sun Nov 07, 2010 4:10 am

Re: New developer features.

Post by Kariban »

That's tentative good news; the other issue I had in RW2 was it wasn't getting called when the control settled on it's final value...
My posts are my opinion, and should be read as such.
crazyfrogbro
Established Forum Member
Posts: 304
Joined: Tue Jan 18, 2011 9:09 pm

Re: New developer features.

Post by crazyfrogbro »

Yesterday i tried again, don't know why but it's called now only when i changed the control values. But doesn't helps much, the update still need to be run and check the player variable, what have been set now in on OnControlValueChange(). Maybe i will put beginupdate there, so it isn't activated if the loco controlled by ai. But for free roam and jump in out locos it wont get disabled after it got enabled by a player.
User avatar
CosmicDebris
Been on the forums for a while
Posts: 285
Joined: Mon May 28, 2007 1:51 am
Location: France

Re: New developer features.

Post by CosmicDebris »

RSBen wrote:
crazyfrogbro wrote:I've found a new "feature"

Code: Select all

Call( "GetIsPlayer" )
Call( "GetIsEngineWithKey" )
both of these lua script commands always returns 0 if i write out them. But always return true if it put into and if like this: if Call( "GetIsPlayer" ) then
Of course that it's player controlled or not, doesn't matters :)
It's a bug not feature? :D
All Call functions will return 1 for true and 0 for false. Unfortunately, 0 does not mean true in LUA. You need to write Call( "GetIsPlayer" ) == 1
I beg to differ, Sir. Anything else than "nil" or a false statement (including "false" itself of course) equates to "true" in a conditional statement (see note), including numbers and strings. I guess you were meaning "unfortunately, 0 does not mean false". This does not change your conclusion by the way. :)

Note: if 0 then print("a") else print("b") end returns "a", yet if 0==true then print("a") else print("b") end returns "b"...
Matthieu
User avatar
RSBen
Getting the hang of things now
Posts: 33
Joined: Sat Feb 26, 2011 1:02 am
Location: Godalming

Re: New developer features.

Post by RSBen »

CosmicDebris wrote:
RSBen wrote:
crazyfrogbro wrote:I've found a new "feature"

Code: Select all

Call( "GetIsPlayer" )
Call( "GetIsEngineWithKey" )
both of these lua script commands always returns 0 if i write out them. But always return true if it put into and if like this: if Call( "GetIsPlayer" ) then
Of course that it's player controlled or not, doesn't matters :)
It's a bug not feature? :D
All Call functions will return 1 for true and 0 for false. Unfortunately, 0 does not mean true in LUA. You need to write Call( "GetIsPlayer" ) == 1
I beg to differ, Sir. Anything else than "nil" or a false statement (including "false" itself of course) equates to "true" in a conditional statement (see note), including numbers and strings. I guess you were meaning "unfortunately, 0 does not mean false". This does not change your conclusion by the way. :)

Note: if 0 then print("a") else print("b") end returns "a", yet if 0==true then print("a") else print("b") end returns "b"...
Yes, that's what I meant and saw my mistake after I posted. Since I haven't posted enough with this account, I have to wait for a moderator to review it, so I couldn't go back and edit it :) Should have just stuck with my old account :roll:
Ben Laws

Any support issues, contact support@railsimulator.com. My views are my own, and do not necessarily reflect the views of RailSimulator.com.
User avatar
jp4712
Petulant Princess
Posts: 4802
Joined: Mon Jul 01, 2002 6:09 pm
Location: Lichfield, Staffordshire
Contact:

Re: New developer features.

Post by jp4712 »

RSBen wrote:Since I haven't posted enough with this account, I have to wait for a moderator to review it, so I couldn't go back and edit it :) Should have just stuck with my old account :roll:
I've cut you loose, Ben - now be a good boy! :lol:

Paul
Visit the Manchester Museum of Transport, the UK's premier bus museum
Locked

Return to “[RW] General RW Discussion”