Commits

Ada Young committed a004bd4

More polished endpoints, one less trigger

Comments (0)

Files changed (1)

   <send>
 world.EnableTrigger("SurveyLine", False)
 world.EnableTrigger("SurveyEnd", False)
-world.EnableTrigger("SurveyPrompt", True)
+if len(areaname) > 0:
+    ProcessWarps(areaname)
+else:
+    Note("WarpDB: Will not manage warps in the wilderness. Sorry!")
   </send>
   </trigger>
   <trigger
 EndPoints(areaname)
   </send>
   </trigger>
-  <trigger
-   group="WarpDB"
-   enabled="n"
-   keep_evaluating="y"
-   match="^\d+h(, \d+m)?(, \d+e)?(, \d+w)? [@cexkdb]*(?: Vote)?-"
-   name="SurveyPrompt"
-   regexp="y"
-   send_to="12"
-   sequence="900"
-  >
-  <send>
-world.EnableTrigger("SurveyPrompt", False)
-if len(areaname) > 0:
-    ProcessWarps(areaname)
-else:
-    Note("WarpDB: Will not manage warps in the wilderness. Sorry!")
-  </send>
-  </trigger>
 </triggers>
 
 <!--  Aliases  -->
 
 areaname = ""
 warp_list = []
-warp_list_ambiguous = []
 
 def WarpLine(warpline):
+    warp_list_ambiguous = []
     warpline = warpline.replace("(house)", "")
     room_names = warpline.split('and')
     if not len(room_names) > 2:
         warp_list.append((room_names[0].strip(), room_names[1].strip()))
     else:
-        warp_list_ambiguous.append(warpline)
+        warp_list_ambiguous.append(warpline) # do something about this
 
 def ProcessWarps(areaname):
     cursor.execute("DELETE FROM arealist WHERE areaname=?", (areaname, ))
     for source, destination in warp_list:
         cursor.execute("INSERT INTO warplist (source, destination, source_areaid) VALUES (?, ?, ?)", (source, destination, areaid))
     db.commit()
-    warp_list = []
-    warp_list_ambiguous = []
-    areaname = ""
 
 def EndPoints(areaname):
     """
     Display endpoints from areaname
     """
     cursor.execute("SELECT id FROM arealist WHERE areaname=?", (areaname, ))
-    areaid = cursor.fetchone()[0]
+    results = cursor.fetchall()
+    if len(results) > 0:
+        areaid = results[0][0]
+    else:
+        Note("WarpDB: No warps have been recorded for this area, try WarpDB:sources here.")
+        return
     cursor.execute("SELECT b1.source, b1.destination, b2.source_areaid FROM warplist as b1 JOIN warplist as b2 WHERE b1.source=b2.destination AND b1.source_areaid=?", (areaid, ))
     results = cursor.fetchall()
-    Note("The following areas are reachable from [%s]:" % areaname)
-    Note("------------------------------")
-    for source, destination, areaid in results:
-        cursor.execute("SELECT areaname FROM arealist WHERE id=?", (areaid, ))
-        dest_area = cursor.fetchone()[0]
-        Note("%s -> %s [%s]" % (source, destination, dest_area))
-    Note("------------------------------")
+    if len(results) > 0:
+        Note("The following recorded areas are reachable from [%s]:" % areaname)
+        Note("------------------------------")
+        for source, destination, areaid in results:
+            cursor.execute("SELECT areaname FROM arealist WHERE id=?", (areaid, ))
+            dest_area = cursor.fetchone()[0]
+            Note("%s -> %s [%s]" % (source, destination, dest_area))
+        Note("------------------------------")
+    else:
+        Note("WarpDB: No areas are reachable from this area, try WarpDB:sources here and in the destination area to link the two.")
 ]]>
 </script>
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.