Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to random bits of the other vehicle (at offset) in CB10 #6018

Closed
DorpsGek opened this issue May 17, 2014 · 3 comments
Closed

Access to random bits of the other vehicle (at offset) in CB10 #6018

DorpsGek opened this issue May 17, 2014 · 3 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

George opened the ticket and wrote:

R26555

http://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Vehicles# Query_variable_of_n-th_vehicle_in_chain_.2861.29 says:

Query variable of n-th vehicle in chain (61)
This is a special variable to get the contents of another variable of a different vehicle in the vehicle chain. It is only supported for trains and road vehicles. It is not supported during a callback that is used to modify vehicle properties to avoid circular dependencies, which currently limits this variable to callbacks 1D, 2D, 31 and 32 plus outside callback scope.

I need to check random bits of the first vehicle inside articulated vehicle to provide correct visual effect position (CB10), but my code does not work.

switch (FEAT_TRAINS, SELF, sm6_b_visual_effect_and_powered0,
[ set_offset_to(-position_in_articulated_veh),
prev_vehicle_randombits() % 2 ])
{
1: sm6_b_visual_effect_and_powered2;
sm6_b_visual_effect_and_powered1;
}

Please provide some variable that can be accessed inside CB10 (Visual effect and wagon power) to check these random bits

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6018
@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 5, 2014

Pikka wrote:

Can you use a random action 2 with a offset to achieve this?


This comment was imported from FlySpray: https://bugs.openttd.org/task/6018#comment13365

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 7, 2014

George wrote:

Yes, I can use workaround, but it is not good to use different solutions in different places.

Current workaround is:
random_switch (FEAT_TRAINS, FORWARD_SELF(10), sm6_06_visual_effect_and_powered_rnd, 0)
{
1: disable_visual_effect_and_powered();
1: sm6_06_visual_effect_and_powered;
}

switch (FEAT_TRAINS, SELF, sm6_b_visual_effect_and_powered0,
position_in_articulated_veh)
{
4: sm6_05_visual_effect_and_powered_rnd;
8: sm6_03_visual_effect_and_powered_rnd;

6: sm6_04_visual_effect_and_powered_rnd;
10: sm6_06_visual_effect_and_powered_rnd;
return disable_visual_effect_and_powered();
}


This comment was imported from FlySpray: https://bugs.openttd.org/task/6018#comment13373

@DorpsGek
Copy link
Member Author

andythenorth closed the ticket.

Reason for closing: Won't implement

Message from George.

- There is a workaround.

Flyspray clean up, so closing this one, thanks.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6018

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Vehicles labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant