News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

[Command_x] I can not place signals

Started by Yona-TYT, June 25, 2017, 07:18:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

Command_x does not work with passing signals  :o

code:
                            local t = command_x(tool_build_roadsign)       
                            local err = t.work(player_x(1), signal[j], "Modern_Signals_right")

Yona-TYT

Is there any way to make this work?  ???

Dwachs

This should work. What error message is returned?
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

@Dwachs
Now I need to indicate the "ribi" so that the signal of passage points to the correct direction.  :P

Dwachs

You have to query get_way_dirs_masked and call work until the ribis are as you like. One call to 'work' works as one click with the mouse.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Solved, thank you !!.  ;D


                    for(local j=0;j<signr;j++){
                         
                        local tile = tile_x(signal[j].coor.x, signal[j].coor.y, signal[j].coor.z)
                        local way = tile.find_object(mo_way)
                        if (!tile.find_object(mo_roadsign)){
                            local t = command_x(tool_build_roadsign)
                            while(true){
                                local err = t.work(player_x(1), my_tile(coord(signal[j].coor.x, signal[j].coor.y)), "Signals")
                                local ribi = way.get_dirs_masked()
                                if (ribi == signal[j].ribi)
                                    break
                            }
                        }
                    }