1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved Custom Web issues

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

  1. Twinki

    Joined:
    Sep 30, 2015
    Messages:
    86
    Likes Received:
    9
    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. Mark Ryan

    Joined:
    Oct 24, 2015
    Messages:
    7
    Likes Received:
    0
    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. Twinki

    Joined:
    Sep 30, 2015
    Messages:
    86
    Likes Received:
    9
    @Cloud @Arbiter @Aidden
     
  5. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,600
    Likes Received:
    990
    Resolved. The edge was in the wrong direction. v.addDirectedEdge(vertex, 25) fixed the issue.
     
    Mark Ryan likes this.

Share This Page

Loading...