Resolved Custom Web issues

Discussion in 'Developer Support' started by Twinki, Oct 21, 2015.

  1. EDIT: Included a debug script bot at the bottom.

    I've started creating my own Web for my API, and I cannot get it to work correctly. I'm currently trying to simply get Lodestones working.

    2ND EDIT: Everything works perfectly if you switch vertex.addDirectedEdge(v, 25); to v.addDirectedEdge(vertext, 25);

    Before:
    Code (Text):
    1.  
    2.     public void addLodestoneVertices() {
    3.         for (Lodestone lodestone : Lodestone.values()) {
    4.             LodestoneVertex vertex = new LodestoneVertex(lodestone);
    5.             Coordinate c = lodestone.getPosition().derive(0, -1);
    6.             WebVertex v = webCustom.getVertexNearestTo(c);
    7.             if (v != null) {
    8.                 double dist = Distance.between(c, v.getPosition());
    9.                 if (dist < 3) {
    10.                     vertex.addDirectedEdge(v, 25);
    11.                     webCustom.addVertices(vertex);
    12.                     debug("Added: " + lodestone);
    13.                     debug(v.distanceTo(vertex));
    14.                 }
    15.             }
    16.         }
    17.     }
    18.  
    After:
    Code (Text):
    1.  
    2.     public void addLodestoneVertices() {
    3.         for (Lodestone lodestone : Lodestone.values()) {
    4.             LodestoneVertex vertex = new LodestoneVertex(lodestone);
    5.             Coordinate c = lodestone.getPosition().derive(0, -1);
    6.             WebVertex v = webCustom.getVertexNearestTo(c);
    7.             if (v != null) {
    8.                 double dist = Distance.between(c, v.getPosition());
    9.                 if (dist < 3) {
    10.                     v.addDirectedEdge(vertex, 25);
    11.                     webCustom.addVertices(vertex);
    12.                     debug("Added: " + lodestone);
    13.                     debug(v.distanceTo(vertex));
    14.                 }
    15.             }
    16.         }
    17.     }
    18.  
    It appears to be using the lodestones like it should now, thanks @Aidden

     

    Attached Files:

    #1 Twinki, Oct 29, 2015
    Last edited: Oct 30, 2015
  2. Best Answer:
    Post #4 by Aidden, Oct 30, 2015
  3. Well I can't see anything wrong with the code , it's probably just an issue with the current web system.
    Maybe an admin could respond and verify?..
     
  4. @Cloud @Arbiter @Aidden
     
  5. Resolved. The edge was in the wrong direction. v.addDirectedEdge(vertex, 25) fixed the issue.
     
    Mark Ryan likes this.

Share This Page

Loading...