The International Simutrans Forum

 

Author Topic: Use start and end coordinates from a script tool in a scenario  (Read 746 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
2 - Can you combine a script tool with a scenario script ?, I mean to be able to pass data from the tool to the scenario script, such as the start and end coordinates from "mark_tiles" for example, with this I can solve a problem in the "Split Regions" script to not use toll gates.


What I am looking for is to use a scripted tool to select an area on the map to save the coordinate values (start and end) and use those values in a script scenario.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4957
  • Languages: EN, DE, AT
Re: Use start and end coordinates from a script tool in a scenario
« Reply #1 on: August 31, 2020, 10:00:52 AM »
Why not catch the calls to is_work_allowed_here? The tool id is a special number indicating that a scripted tool is behind.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
Re: Use start and end coordinates from a script tool in a scenario
« Reply #2 on: August 31, 2020, 07:09:30 PM »
Certainly this can work, using the "tool_id", but how but how would you go about getting the start and end coordinates in a two-click tool?.  ???

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4957
  • Languages: EN, DE, AT
Re: Use start and end coordinates from a script tool in a scenario
« Reply #3 on: September 01, 2020, 07:10:22 AM »
Each click should be send to the scenario. But it seems impossible to distinguish first and second.

For your request, I could think of implementing a very low-level communication between scripts: just sending strings and numbers between them.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1845
    • Simutrans-BLOG
  • Languages: ES
Re: Use start and end coordinates from a script tool in a scenario
« Reply #4 on: September 01, 2020, 08:00:40 AM »
Each click should be send to the scenario. But it seems impossible to distinguish first and second.
Certainly, it was precisely this that gave me headaches in the past, when I was trying to mark the beginning and the end of a road at the time of its construction.  :o

For your request, I could think of implementing a very low-level communication between scripts: just sending strings and numbers between them.
This sounds interesting.  8)