home *** CD-ROM | disk | FTP | other *** search
/ IT.SOFT 22 / ITSOFTCD_22.iso / pc / shareware22 / file3 / MUSHCLIENT213.ZIP / exampscript.vbs next >
Encoding:
Text File  |  1997-06-16  |  3.3 KB  |  149 lines

  1. option explicit
  2.  
  3. sub showtriggers 
  4.  
  5. dim mylist
  6. dim i
  7.  
  8. mylist = world.GetTriggerList
  9.  
  10. for i = lbound (mylist) to ubound (mylist)
  11.   world.note mylist (i)
  12. next
  13.  
  14. end sub
  15.  
  16. sub showvariables 
  17.  
  18. dim mylist
  19. dim i
  20.  
  21. mylist = world.GetVariableList
  22.  
  23. for i = lbound (mylist) to ubound (mylist)
  24.   world.note mylist (i) & " = " & world.GetVariable (mylist (i))
  25. next
  26.  
  27. end sub
  28.  
  29. sub showaliases
  30.  
  31. dim mylist
  32. dim i
  33.  
  34. mylist = world.GetAliasList
  35.  
  36. for i = lbound (mylist) to ubound (mylist)
  37.   world.note mylist (i)
  38. next
  39.  
  40. end sub
  41.  
  42. sub OnWorldOpen
  43. world.note "---------- World Open ------------"
  44. end sub
  45.  
  46. sub OnWorldClose
  47. world.note "---------- World Close ------------"
  48. end sub
  49.  
  50. sub OnWorldConnect
  51. world.note "---------- World Connect ------------"
  52. end sub
  53.  
  54. sub OnWorldDisconnect
  55. world.note "---------- World Disconnect  ------------"
  56. end sub
  57.  
  58. sub OnTeleport (thename, theoutput, theparameter)
  59.  
  60. dim sDestination
  61. dim sRoomList
  62. dim sHelp
  63. dim iSubscript
  64. dim iRoom
  65.  
  66. sDestination = Trim (theparameter)
  67.  
  68. ' if nothing entered echo possible destinations
  69. if sDestination = "" then
  70.   world.note "-------- TELEPORT destinations ----------"    
  71.  
  72.   ' find list of all variables
  73.   sRoomList = world.GetVariableList
  74.  
  75.   ' loop through each variable, and add to help if it starts with "teleport_"
  76.   for iSubscript = lbound (sRoomList) to ubound (sRoomList)
  77.      if Left (sRoomList (iSubscript), 9) = "teleport_" then
  78.         if sHelp <> "" then
  79.           sHelp = sHelp & ", "
  80.         end if
  81.         sHelp = sHelp & Mid (sRoomList (iSubscript), 10)
  82.      end if   ' variable starts with "teleport_"
  83.   next        ' loop through sRoomList
  84.  
  85.   ' if no destinations found, tell them
  86.   if sHelp = "" then
  87.     sHelp = "<no rooms in teleport list>"
  88.   end if    ' no destinations found in list
  89.   world.note sHelp
  90.   exit sub
  91.  
  92. end if    ' no destination supplied
  93.  
  94. ' get contents of the destination variable 
  95. iRoom = world.GetVariable ("teleport_" & lCase (sDestination))
  96.  
  97. ' if not found, or invalid name, that isn't in the list
  98. if IsEmpty (iRoom) or IsNull (iRoom) then
  99.   world.note "******** Destination " & sDestination & " unknown *********"
  100.   exit sub
  101. end if
  102.  
  103. world.note "------> Teleporting to " & sDestination
  104. world.send "@teleport #" & cstr (iRoom)
  105.  
  106. end sub
  107.  
  108. sub OnAddTeleport (thename, theoutput, theparameter)
  109.  
  110. dim sDestination
  111. dim sParameter
  112. dim iSpace
  113. dim iRoom
  114. dim iStatus
  115. dim sCurrentLocation
  116.  
  117. sParameter = Trim (theparameter)
  118. iSpace = InStr (1, sParameter, " ", 1)
  119.  
  120. ' if nothing entered tell them command syntax
  121. if iSpace = 0 then
  122.   world.note "Syntax: add_teleport name dbref"
  123.   world.note "    eg. add_teleport LandingBay 4421"
  124.   exit sub
  125. end if
  126.  
  127. sDestination = Trim (Left (sParameter, iSpace))
  128. iRoom = Trim (Mid (sParameter, iSpace + 1))
  129.  
  130. if not IsNumeric (iRoom) then
  131.   world.note "Room to teleport to must be a number, you entered: " & iRoom
  132.   exit sub
  133. end if
  134.  
  135. ' add room and destination location to variable list
  136. iStatus = world.SetVariable ("teleport_" & sDestination, iRoom)
  137.  
  138. if iStatus <> 0 then
  139.   world.note "Room name must be alphabetic, you entered: " & sDestination
  140.   exit sub
  141. end if
  142.  
  143. world.note "Teleport location " & sDestination & "(#" _
  144.            & iRoom & ") added to teleport list"
  145.  
  146. end sub
  147.  
  148. world.note "Scripting enabled - script file processed"
  149.