Are these actions possible using plugins?

EDG wrote:
Feature Requests:

- The ability to delete stars that do not have routes attached. This would make the 2D maps less cluttered (especially for situations where you can't go to the stars without routes anyway).

- And also, an option to label only the stars that have routes associated with them.

Are these possible to implement using plugins?

Comments

  • Yes.

    For #2, thats not something you'd do in script, but rather use a script to set the visibility of the bodies, and then set the filters to 'hide labels only'
  • Hm. What about "only show routes that ultimately connect to Sol"? Is that something that can be done using a plugin?

    e.g. I use "Proximity Routes" to connect stars together, but I don't want to see the routes that don't ultimately connect back to Sol (that are their own little route networks somewhere else).
  • Having looked at the API again, I have to pretty much give up before I even start because it's so useless.

    I can't even find a property in there that allows me to check if the system is on a route (and therefore if it needs a visible label or not). There's an "OnRoute" method in there that says:
    OnRoute( b: Body): Boolean

    , which (like many of the entries in there) is pretty meaningless to me because there's no explanation of what that means or even does. I tried to modify the LabelDistance plugin so that if a system was on a route then its label would be shown in a different colour (just as a start), but I can't even figure out how to do that. I'd guess it may have something to do with the GetRoute method, and then somehow using OnRoute (if that does what it sounds like, which is to see if a system is on a route or not) but I have no idea.

    There's also a RouteWaypoint class, but I have no idea what that does either because there's no explanation.

    This is what i have so far (this is based on the Mass Label Distance change plugin at http://www.nbos.com/nox/index.php?action=1001&id=101 ):
    #plugin  Route visibility
    #author	EDG (based on NBOS)
    #desc Change the label properties of RECONS routes 
    
    sector = GetCurrentSector()
    j = sector.RouteCount
    For i = 1 to j 
    	o = sector.GetRoute( i-1)
    	o.Modified = true
    	If o.RouteType = "RECONS" Then
    		o.LabelDistance = 75
    		o.RouteDistance = 1000
    		o.LabelColor = 100000
    	End If
    
    	If i mod 500 = 0 Then
    		sector.RenderMessageBig = "Updating Label Distances: " & Int( (i / j) * 100) & "%"
    		sector.RenderMessageSmall = "Press Esc to cancel"
    		RefreshScene
    		
    		'check Cancel
    		k = GetKey()
    		if k = 27 then Exit For
    
    	End If
    	
    Next
    sector.RenderMessageBig = ""
    sector.RenderMessageSmall = ""
    RefreshScene
    

    Does anyone have any idea how to do this?
  • I've fudged around it a bit by adding a string to the GMNotes field of the stars I'm interested in and searching for that, but that's obviously not ideal. I'd really like a way for the program to just change the labels etc on the stars that are on specific types of Route without me having to make them any more "special" by adding stuff to fields.
    #plugin  Route  Distance
    #author EDG (based on NBOS)
    #desc Changes the label distance of every system on the map
    
    sector = GetCurrentSector()
    j = sector.SystemCount
    For i = 1 to j 
    	o = sector.GetSystem( i-1)
    	o.Modified = true
    	If o.GMNotes = "1" Then
    		o.LabelDistance = 75
    		o.RouteDistance = 1000
    		o.LabelColor = 500000
    	End If
    
    
    	If i mod 500 = 0 Then
    		sector.RenderMessageBig = "Updating Label Distances: " & Int( (i / j) * 100) & "%"
    		sector.RenderMessageSmall = "Press Esc to cancel"
    		RefreshScene
    		
    		'check Cancel
    		k = GetKey()
    		if k = 27 then Exit For
    
    	End If
    	
    Next
    sector.RenderMessageBig = ""
    sector.RenderMessageSmall = ""
    RefreshScene
    
  • I'd guess it may have something to do with the GetRoute method, and then somehow using OnRoute (if that does what it sounds like, which is to see if a system is on a route or not) but I have no idea.

    There's also a RouteWaypoint class, but I have no idea what that does either because there's no explanation.

    So, does anyone know what these functions do (preferably with examples)? Or how I can change route properties en masse with a plugin?
  • If I understand what you want to do - make only those bodies on routes visible - then this process should work:

    - Mark all systems on the map hidden (visible = false)
    - Cycle through all the routes (use the Sector's RouteCount method to get the number of routes, and GetRoute to get the route object)
    - For each route, Cycle through all the waypoints for that route (use the Route's WaypointCount and GetWaypoint methods)
    - Set the visibility of the waypoint's body attribute to true
    - Refresh the map
  • So what is "OnRoute" used for?
  • That will tell you if a specific body is on a particular given route. But I think it'd be faster to go the other way, and rather than testing each body for each route, instead just marking the bodies on routes as above.
  • As this is a route-related thread and also asks about capabilities, I have a question:

    I'm doing a fair bit of in-system activity. Is it possible for AS to allow the creation of and perhaps display in-system trade routes?

    Obviously the script to calculate them would have to differ because you'd have to use system bodies and their populations etc rather than using full system data and you'd want to see the route lines on your system diagram.

    So my question is whether something like this is possible? There's a lot of interest can happen within a system with a lot of inhabited bodies and space stations particularly.
  • No, there's no facility at all to display in-system routes. I dont know if such would be meaningful given that the position of every body changes as they orbit. There wouldnt be a 'route' per se. Thats unlike in interstellar travel where, if ships have limited ranges, a specific route needs to be followed to reach a destination.
  • Well, in one sense, I agree. You would not fly that route since orbital mechanics would dictate otherwise (esp if it went through the sun at the moment).

    What it would show though is the relationship between populated bodies and perhaps which traded with which.

    I guess visually it could get quite ugly and that in itself might be a reason to not do this. I suppose I just have a perl script or something figure out the appropriate trade volumes and dump it out as a matrix. I mostly want it as an automated way to suggest where the heavy trade flows would be.

    Depending on your assumptions about costs of inter-system travel (can be quite expensive in delta V for hard sci universes/games versus the space opera ones), you might end up having routes that are/are not economically or practically viable at different times due to orbital mechanics and the amount of delta V involved. Getting from A to B when they are both near in a system might be hugely different than A to B when they are on opposite sides of the sun.

    Similarly, if B has a very eccentric orbit and/or one heavily inclined to the principal plane of the system, A and B might be close on one part of B's eccentric orbit, but very far on the other.

    So I have to agree with you. My intial idea was it would be nice to see the routes, but they could well be messy and somewhat periodic.

    Sometimes something that seemed like a good idea on first glance gets the bin when further analysis is applied.
  • Take a look at my Trade Route Perl Script v1.1 on the NBOS download site. I wrote a script that will determine trade routes based on the population of the systems and the potential economic value of a system based on asteroid belts, high density planets, Gas Giants, and the absence of White Dwarves. The routes are given weights based on the number of times the route is used in getting from one important system to another. There is a PDF document describing the script and I'd be happy to explain. It sounds like you may have some Perl skills, so you may be able to take the script and modify it for your purposes, like taking out the linking routes that ensure all of the stars are in one network.

    Toby
  • Long time getting back to this, but I'll look at that script.

    I'd may also want a script like that which respects political boundaries as those would potentially limit or prohibit trade.

    I'm not a perl pro, but I did overhaul a bunch of perl used to monitor and control an n-tier, distributed cell phone policy networked stack and I was told I did pretty well so I can take a crack at it.

    It's funny how this is like 8 years old... and now I'm getting back to a variation of the original project. Life sure sidelines some plans for a long time...

Leave a Comment