Author Topic: [Command_x] I can not place signals  (Read 635 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

[Command_x] I can not place signals
« on: June 25, 2017, 07:18:46 PM »
Command_x does not work with passing signals  :o

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

Offline Yona-TYT

Re: [Command_x] I can not place signals
« Reply #1 on: June 30, 2017, 07:34:39 PM »
Is there any way to make this work?  ???

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4251
  • Total likes: 177
  • Helpful: 149
  • Languages: EN, DE, AT
Re: [Command_x] I can not place signals
« Reply #2 on: July 02, 2017, 11:23:55 AM »
This should work. What error message is returned?
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT

Re: [Command_x] I can not place signals
« Reply #3 on: July 04, 2017, 03:59:59 PM »
@Dwachs
Now I need to indicate the "ribi" so that the signal of passage points to the correct direction.  :P

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4251
  • Total likes: 177
  • Helpful: 149
  • Languages: EN, DE, AT
Re: [Command_x] I can not place signals
« Reply #4 on: July 05, 2017, 05:57:03 PM »
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.

Offline Yona-TYT

Re: [Command_x] I can not place signals
« Reply #5 on: July 10, 2017, 02:39:17 AM »
Solved, thank you !!.  ;D

Code: [Select]
                    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
                            }
                        }
                    }