It is currently 29 Mar 2024, 09:51

WELCOME TO SIMUSCAPE!


Please Sign in or Register to enable all features, remove restrictions and gain additional access!
For information on how to bypass the CAPTCHA or to contact Team Simuscape, Continue Here!


Post a new topicPost a reply Page 1 of 1   [ 10 posts ]
Author Message
PostPosted: 06 Jan 2013, 22:34 
Player
Player
User avatar

Joined: 06 Mar 2012, 21:55
Posts: 480
Location: The Netherlands
Hi all,
Well I'm busy with a new project and got stuck once again ;-)
I would like to make a stationtile that changes it's graphics when a train passes it (like the trainshed in the ISR set, that opens/closes a door when a train passes).
I have 8 different graphics (2 platforms x 2 rotations x 2 different graphics on the platforms).
My question is how should the code look for var09 in action0 and how should the action2's be coded?

I tried to figure it out from the code of the ISR-shed, but that also has some other features so I can't really figure out what pieces of code are for what.

Could you all shine some light on the matter?


Top
 Offline Profile  
 
PostPosted: 07 Jan 2013, 00:01 
Player
Player

Joined: 12 Mar 2012, 02:39
Posts: 469
Quast65 wrote:
... I would like to make a stationtile that changes it's graphics when a train passes it (like the trainshed in the ISR set, that opens/closes a door when a train passes).
I have 8 different graphics (2 platforms x 2 rotations x 2 different graphics on the platforms).
There are 2 ways of doing that ... a wasteful but easy one and a more effective but more difficult one.

a) the easy one ...
place all the sprites for ONE situation in an action-1 block; then add the same of the other situation in a second block. (The same as if you would do a snow/no snow implementation).

Then the var action-2 looks like this :
Code:
02 04 xx 81 44 00 01 01 [go to door open] 00 01 01 [go to door closed] 00

b) the more complex one ...
create 2 tile definitions in an action-0 property 0x09; one using the sprites for doors closed, the other for doors open. Each of these will get a Tile-ID. That could be 0x00 (closed doors) and 0x02 (open doors}. The 2 definitions differ only in sprite numbers used for the one or the other situation.

Then in the CB14 chain check var 44, like this :
Code:
02 04 xx 81 44 00 01 01 00 80 01 01 02 80
setting the Tile-ID to be used.

When displaying the tile it will then either use definition 0x00 without train activity or 0x02 if a train as reserved the track.

BTW, there are only even numbered definitions; the odd ones can be ignored they are for the other direction of a station tile and are dealt with automatically.


Top
 Offline Profile  
 
PostPosted: 07 Jan 2013, 00:16 
Player
Player
User avatar

Joined: 06 Mar 2012, 21:55
Posts: 480
Location: The Netherlands
thnx for the reply!
Let's focus on the "easy"one first ;-)
Should there be a normal action2 after each action1 block? Or only after the Action0?
Furthermore, should the action0 only have the var09 or also a callback?


Top
 Offline Profile  
 
PostPosted: 07 Jan 2013, 01:00 
Player
Player

Joined: 12 Mar 2012, 02:39
Posts: 469
Quast65 wrote:
... Should there be a normal action2 after each action1 block? Or only after the Action0?
If you already have a working GRF with one set of sprites, then you'll only need to add a second block of sprites (the one with the open doors) to your action-1 (don't forget to increment the number of sets not the number of sprites though).

Add another action-2 below the one you already have. Point the new one to the second set of sprites in the action-1.

Below that, you add the var 44-check, pointing to the one or the other action-2

From the action-3 go to the var act-2 that checks var 44.

That should be all ...

Quote:
Furthermore, should the action0 only have the var09 or also a callback?
If you do not use any callbacks now, you will not need one either. The action-0 can remain unchanged.


Top
 Offline Profile  
 
PostPosted: 07 Jan 2013, 01:15 
Player
Player
User avatar

Joined: 06 Mar 2012, 21:55
Posts: 480
Location: The Netherlands
Thnx for your help!

Using this code:
Code:
  918 * 4    01 04 01 04
  919 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 8 8020 09 122 64 -31 -91
  920 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 88 8020 09 122 64 -31 -91
  921 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 168 8020 09 122 64 -31 -91
  922 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 248 8020 09 122 64 -31 -91
  923 * 7    02 04 00 00 01 00 00
  924 * 4    01 04 01 04
  925 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 8 8160 09 122 64 -31 -91
  926 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 88 8160 09 122 64 -31 -91
  927 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 168 8160 09 122 64 -31 -91
  928 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 248 8160 09 122 64 -31 -91
  929 * 7    02 04 01 00 01 00 00
  930 * 64    00 04 03 01 38 08 "DSA0" 09 02
                 F4 03 00 00 00 00 00 10 05 03 2D 84 00 00 00 00 00 10 10 7A 2E 84 00 00 80
                 F3 03 00 00 00 00 00 05 10 03 2F 84 00 00 00 00 00 10 10 7A 30 84 00 00 80
                 11 00
  931 * 14    02 04 02 81 44 00 01 01 01 00 01 01 00 00
  932 * 10    03 04 01 38 01 FF 00 00 02 00
  933 * 21    04 48 FF 01 38 "ÅPlatform Front" 00
  934 * 45    04 48 FF 01 38 "ÄDutch Addition: Single sided platforms" 00


And these graphics:
Attachment:
Var44action2.png
Var44action2.png [ 7.96 KiB | Viewed 7692 times ]


I got this!!
Attachment:
DSAset14.png
DSAset14.png [ 14.06 KiB | Viewed 7692 times ]


Same tile, different graphic when a train passes. There is a very very happy Dutchman on the other line of internet ;-) Thnx again OzTrans!
By the way, all code and graphics are GPLv2.


Top
 Offline Profile  
 
PostPosted: 07 Jan 2013, 04:10 
Moderator
User avatar

Joined: 29 Feb 2012, 00:55
Posts: 1770
Location: Hellas
If there could be a way to change graphics when train is approaching a station (aka previous tile) we could have some nice blinking lights in advance. Is it possible?


Top
 Offline Profile  
 
PostPosted: 07 Jan 2013, 08:06 
Player
Player

Joined: 12 Mar 2012, 02:39
Posts: 469
Your code could have looked like this :
Code:
  918 * 4    01 04 02 04
  919 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 8 8020 09 122 64 -31 -91
  920 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 88 8020 09 122 64 -31 -91
  921 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 168 8020 09 122 64 -31 -91
  922 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 248 8020 09 122 64 -31 -91
  925 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 8 8160 09 122 64 -31 -91
  926 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 88 8160 09 122 64 -31 -91
  927 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 168 8160 09 122 64 -31 -91
  928 c:\grfmaken\grfcodecwin\delft/dstatadd.pcx 248 8160 09 122 64 -31 -91
  923 * 7    02 04 00 00 01 00 00
  929 * 7    02 04 01 00 01 01 00
  930 * 64    00 04 03 01 38 08 "DSA0" 09 02
                 F4 03 00 00 00 00 00 10 05 03 2D 84 00 00 00 00 00 10 10 7A 2E 84 00 00 80
                 F3 03 00 00 00 00 00 05 10 03 2F 84 00 00 00 00 00 10 10 7A 30 84 00 00 80
                 11 00
  931 * 14    02 04 02 81 44 00 01 01 01 00 01 01 00 00
  932 * 10    03 04 01 38 01 FF 00 00 02 00
  933 * 21    04 48 FF 01 38 "ÅPlatform Front" 00
  934 * 45    04 48 FF 01 38 "ÄDutch Addition: Single sided platforms" 00

athanasios wrote:
If there could be a way to change graphics when train is approaching a station (aka previous tile) we could have some nice blinking lights in advance. Is it possible?
PBS reserves a path a soon as the train passes the signal (if it is a PBS signal) in front of the station. That is when you could turn the lights on or change graphics.

An example :
In CanStn v1.x there is a flora tile (pine tree) (in an arctic game only). That tree turns into a XMas tree in December and the station master turns the lights on when there is train activity on that platform. You may want to have a look at it.


Top
 Offline Profile  
 
PostPosted: 08 Jan 2013, 04:23 
Moderator
User avatar

Joined: 29 Feb 2012, 00:55
Posts: 1770
Location: Hellas
Thanks. That's great!


Top
 Offline Profile  
 
PostPosted: 24 Jan 2013, 20:58 
Player
Player
User avatar

Joined: 06 Mar 2012, 21:55
Posts: 480
Location: The Netherlands
A new GRf has seen the light that uses the code you guys helped me on:
http://www.tt-forums.net/viewtopic.php?f=26&t=64121


Top
 Offline Profile  
 
PostPosted: 24 Jan 2013, 21:13 
Simuscape Admin
User avatar

Joined: 15 Sep 2011, 09:25
Posts: 3033
Location: Sweden
Looks good Quast65! :) Glad we could help... :W

_________________
Image

Simuscape - A world of its own;
SimuTalk | Visual Studio | INFRA Diary

INFRA - Chose Your Destination;
INFRA Projects | INFRA Downloads


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 10 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


Status SimuscapeTerms of UseAbout Simuscape

Design by SAC © 2012-2015, Sweden • Powered by phpBB • Based on twilightBB by Daniel St. Jules