Guest User

Untitled

a guest
Dec 28th, 2010
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE MudletPackage>
  3. <MudletPackage version="1.0">
  4. <TriggerPackage>
  5. <TriggerGroup isActive="yes" isFolder="yes" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  6. <name>Mudlet Mapper</name>
  7. <script></script>
  8. <triggerType>0</triggerType>
  9. <conditonLineDelta>0</conditonLineDelta>
  10. <mStayOpen>0</mStayOpen>
  11. <mCommand></mCommand>
  12. <mFgColor>#ff0000</mFgColor>
  13. <mBgColor>#ffff00</mBgColor>
  14. <mSoundFile></mSoundFile>
  15. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  16. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  17. <regexCodeList/>
  18. <regexCodePropertyList/>
  19. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  20. <name>swim exit</name>
  21. <script>send(&quot;swim &quot; .. speedWalkDir[speedWalkCounter], false)</script>
  22. <triggerType>0</triggerType>
  23. <conditonLineDelta>0</conditonLineDelta>
  24. <mStayOpen>0</mStayOpen>
  25. <mCommand></mCommand>
  26. <mFgColor>#ff0000</mFgColor>
  27. <mBgColor>#ffff00</mBgColor>
  28. <mSoundFile></mSoundFile>
  29. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  30. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  31. <regexCodeList>
  32. <string>There's water ahead of you. You'll have to swim in that direction to make it through.</string>
  33. <string>There's water ahead of you. You'll have to swim in that direction to make it </string>
  34. </regexCodeList>
  35. <regexCodePropertyList>
  36. <integer>3</integer>
  37. <integer>3</integer>
  38. </regexCodePropertyList>
  39. </Trigger>
  40. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  41. <name>door </name>
  42. <script>mmp.failpath()</script>
  43. <triggerType>0</triggerType>
  44. <conditonLineDelta>0</conditonLineDelta>
  45. <mStayOpen>0</mStayOpen>
  46. <mCommand></mCommand>
  47. <mFgColor>#ff0000</mFgColor>
  48. <mBgColor>#ffff00</mBgColor>
  49. <mSoundFile></mSoundFile>
  50. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  51. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  52. <regexCodeList>
  53. <string>There is a door in the way, to the</string>
  54. <string>There is a door in the way.</string>
  55. </regexCodeList>
  56. <regexCodePropertyList>
  57. <integer>2</integer>
  58. <integer>3</integer>
  59. </regexCodePropertyList>
  60. </Trigger>
  61. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  62. <name>Gallop</name>
  63. <script>speedWalkCounter = speedWalkCounter - 1
  64. speedwalking(&quot;Room&quot;, speedWalkPath[speedWalkCounter])</script>
  65. <triggerType>0</triggerType>
  66. <conditonLineDelta>99</conditonLineDelta>
  67. <mStayOpen>0</mStayOpen>
  68. <mCommand></mCommand>
  69. <mFgColor>#ff0000</mFgColor>
  70. <mBgColor>#ffff00</mBgColor>
  71. <mSoundFile></mSoundFile>
  72. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  73. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  74. <regexCodeList>
  75. <string>You kick your mount in the haunches.</string>
  76. </regexCodeList>
  77. <regexCodePropertyList>
  78. <integer>0</integer>
  79. </regexCodePropertyList>
  80. </Trigger>
  81. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  82. <name>Too quick</name>
  83. <script>mmp.deleteLineP()</script>
  84. <triggerType>0</triggerType>
  85. <conditonLineDelta>99</conditonLineDelta>
  86. <mStayOpen>0</mStayOpen>
  87. <mCommand></mCommand>
  88. <mFgColor>#ff0000</mFgColor>
  89. <mBgColor>#ffff00</mBgColor>
  90. <mSoundFile></mSoundFile>
  91. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  92. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  93. <regexCodeList>
  94. <string>Now now, don't be so hasty!</string>
  95. </regexCodeList>
  96. <regexCodePropertyList>
  97. <integer>3</integer>
  98. </regexCodePropertyList>
  99. </Trigger>
  100. <TriggerGroup isActive="yes" isFolder="yes" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  101. <name>Lusternia</name>
  102. <script></script>
  103. <triggerType>0</triggerType>
  104. <conditonLineDelta>0</conditonLineDelta>
  105. <mStayOpen>0</mStayOpen>
  106. <mCommand></mCommand>
  107. <mFgColor>#ff0000</mFgColor>
  108. <mBgColor>#ffff00</mBgColor>
  109. <mSoundFile></mSoundFile>
  110. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  111. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  112. <regexCodeList/>
  113. <regexCodePropertyList/>
  114. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  115. <name>Mudlet Mapper Lusternia Scent</name>
  116. <script>mmp.tempscent = {}</script>
  117. <triggerType>0</triggerType>
  118. <conditonLineDelta>99</conditonLineDelta>
  119. <mStayOpen>100</mStayOpen>
  120. <mCommand></mCommand>
  121. <mFgColor>#ff0000</mFgColor>
  122. <mBgColor>#ffff00</mBgColor>
  123. <mSoundFile></mSoundFile>
  124. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  125. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  126. <regexCodeList>
  127. <string>You scent at the air, your skilled nose picking up the faint traces of others in the surrounding area.</string>
  128. <string>You snort and snuffle at the air, sensing through a ridiculous pig nose upon your face the faint traces of others in the surrounding area.</string>
  129. </regexCodeList>
  130. <regexCodePropertyList>
  131. <integer>3</integer>
  132. <integer>3</integer>
  133. </regexCodePropertyList>
  134. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  135. <name>Got line</name>
  136. <script>--deleteLine()
  137.  
  138. selectString(line, 1) replace&quot;&quot;
  139.  
  140. -- get the name
  141. cecho(&quot;&lt;green&gt;&quot;..matches[2]..&quot;&lt;reset&gt;: &quot;)
  142.  
  143. -- ids
  144. mmp.echonums(matches[3])
  145.  
  146. -- pad spaces so we have aligned roomname
  147. echo(string.rep(&quot; &quot;, 25 - #getCurrentLine()))
  148.  
  149. -- and finally, the roomname
  150. echo(matches[3])
  151.  
  152.  
  153. if mmp.tempscent[matches[3]] then
  154. mmp.tempscent[matches[3]][#mmp.tempscent[matches[3]]+1] = matches[2]
  155. else
  156. mmp.tempscent[matches[3]] = {matches[2]}
  157. end
  158.  
  159. -- save in our person tracking db
  160. mmp.pdb[matches[2]] = matches[3]</script>
  161. <triggerType>0</triggerType>
  162. <conditonLineDelta>0</conditonLineDelta>
  163. <mStayOpen>0</mStayOpen>
  164. <mCommand></mCommand>
  165. <mFgColor>#ff0000</mFgColor>
  166. <mBgColor>#ffff00</mBgColor>
  167. <mSoundFile></mSoundFile>
  168. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  169. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  170. <regexCodeList>
  171. <string>^You make out the scent of (\w+) coming from (.+)\.$</string>
  172. </regexCodeList>
  173. <regexCodePropertyList>
  174. <integer>1</integer>
  175. </regexCodePropertyList>
  176. </Trigger>
  177. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  178. <name>Stop capturing</name>
  179. <script>setTriggerStayOpen(&quot;Mudlet Mapper Lusternia Scent&quot;, 0)
  180.  
  181. --[[for area, names in pairs(mmp.tempscent) do
  182. for _, name in ipairs(names) do
  183.  
  184. -- get the name
  185. cecho(&quot;\n&lt;green&gt;&quot;..name..&quot;&lt;reset&gt;: &quot;)
  186.  
  187. -- ids
  188. mmp.echonums(area)
  189.  
  190. -- pad spaces so we have aligned roomname
  191. echo(string.rep(&quot; &quot;, 25 - #getCurrentLine()))
  192.  
  193. -- and finally, the roomname
  194. echo(area)
  195. end
  196. end]]
  197.  
  198.  
  199. raiseEvent(&quot;mmapper updated pdb&quot;)</script>
  200. <triggerType>0</triggerType>
  201. <conditonLineDelta>0</conditonLineDelta>
  202. <mStayOpen>0</mStayOpen>
  203. <mCommand></mCommand>
  204. <mFgColor>#ff0000</mFgColor>
  205. <mBgColor>#ffff00</mBgColor>
  206. <mSoundFile></mSoundFile>
  207. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  208. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  209. <regexCodeList>
  210. <string>return isPrompt()</string>
  211. </regexCodeList>
  212. <regexCodePropertyList>
  213. <integer>4</integer>
  214. </regexCodePropertyList>
  215. </Trigger>
  216. </Trigger>
  217. <Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="yes" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
  218. <name>Deathsight</name>
  219. <script>echo &quot; &quot;; mmp.echonums(multimatches[2][2])
  220.  
  221. local t = mmp.getnums(multimatches[2][2])
  222. if not t then return end
  223.  
  224. echo&quot;\n&quot;
  225.  
  226. if #t == 1 then
  227. cecho(&quot;&lt;red&gt;From your knowledge, that happened in &lt;orange_red&gt;&quot;..mmp.areatabler[getRoomArea(t[1])]..&quot;&lt;red&gt;.&quot;)
  228. else
  229. cecho(&quot;&lt;red&gt;From your knowledge, that possibly happened in &lt;orange_red&gt;&quot;..mmp.areatabler[getRoomArea(t[1])]..&quot;&lt;red&gt;.&quot;)
  230. end</script>
  231. <triggerType>0</triggerType>
  232. <conditonLineDelta>0</conditonLineDelta>
  233. <mStayOpen>0</mStayOpen>
  234. <mCommand></mCommand>
  235. <mFgColor>#ff0000</mFgColor>
  236. <mBgColor>#ffff00</mBgColor>
  237. <mSoundFile></mSoundFile>
  238. <colorTriggerFgColor>#000000</colorTriggerFgColor>
  239. <colorTriggerBgColor>#000000</colorTriggerBgColor>
  240. <regexCodeList>
  241. <string>You see the death occur at</string>
  242. <string>^You see the death occur at (.+)\.$</string>
  243. </regexCodeList>
  244. <regexCodePropertyList>
  245. <integer>2</integer>
  246. <integer>1</integer>
  247. </regexCodePropertyList>
  248. </Trigger>
  249. </TriggerGroup>
  250. </TriggerGroup>
  251. </TriggerPackage>
  252. <TimerPackage/>
  253. <AliasPackage>
  254. <AliasGroup isActive="yes" isFolder="yes">
  255. <name>Mudlet Mapper</name>
  256. <script></script>
  257. <command></command>
  258. <regex></regex>
  259. <Alias isActive="yes" isFolder="no">
  260. <name>Go to ID or area</name>
  261. <script>local where = matches[2]
  262.  
  263. -- goto room ID
  264. if tonumber(where) then
  265. mmp.gotoRoom(where, matches[3])
  266. else
  267. -- locate area
  268.  
  269. -- goto area?
  270. end</script>
  271. <command></command>
  272. <regex>^goto (\w+)(?: (\w+))?$</regex>
  273. </Alias>
  274. <Alias isActive="yes" isFolder="no">
  275. <name>Toggle pause</name>
  276. <script>mmp.pause(matches[2])</script>
  277. <command></command>
  278. <regex>^mpp(?:\s?(on|off))?$</regex>
  279. </Alias>
  280. <Alias isActive="yes" isFolder="no">
  281. <name>Stop walking</name>
  282. <script>mmp.stop()</script>
  283. <command></command>
  284. <regex>^mstop$</regex>
  285. </Alias>
  286. <Alias isActive="yes" isFolder="no">
  287. <name>Option</name>
  288. <script>if not matches[2] then
  289. mmp.settings:showAllOptions()
  290. return
  291. end
  292.  
  293. local val = matches[4]
  294. if val == &quot;true&quot; or val == &quot;yes&quot; or val == &quot;on&quot; then val = true end
  295. if val == &quot;false&quot; or val == &quot;no&quot; or val == &quot;off&quot; then val = false end
  296.  
  297. mmp.settings:setOption(matches[3], val)</script>
  298. <command></command>
  299. <regex>^mconfig( (\w+) (.*))?$</regex>
  300. </Alias>
  301. <Alias isActive="yes" isFolder="no">
  302. <name>Display Area for Lock/Unlock</name>
  303. <script>mmp.doLockArea(matches[2])</script>
  304. <command></command>
  305. <regex>^mmp arealock(?: (.*))?$</regex>
  306. </Alias>
  307. <Alias isActive="yes" isFolder="no">
  308. <name>Room find</name>
  309. <script>mmp.roomFind(matches[2])</script>
  310. <command></command>
  311. <regex>^(?:rf|room find) (.+)$</regex>
  312. </Alias>
  313. </AliasGroup>
  314. </AliasPackage>
  315. <ActionPackage/>
  316. <ScriptPackage>
  317. <ScriptGroup isActive="yes" isFolder="yes">
  318. <name>Mudlet Mapper</name>
  319. <script>-------------------------------------------------
  320. -- Put your Lua functions here. --
  321. -- --
  322. -- Note that you can also use external Scripts --
  323. -------------------------------------------------
  324. </script>
  325. <eventHandlerList/>
  326. <Script isActive="yes" isFolder="no">
  327. <name>speedwalking</name>
  328. <script>speedWalkWatch = createStopWatch()
  329. speedWalkPath = speedWalkPath or {}
  330. speedWalkDir = speedWalkDir or {}
  331. speedWalkCounter = 0
  332.  
  333. -- mmp = mudlet mapper
  334. mmp = mmp or {
  335. paused = false,
  336. autowalking = false,
  337. currentroom = false,
  338. firstRun = true
  339. }
  340.  
  341. function mmp.startup()
  342. if not mmp.firstRun then
  343. return
  344. end
  345.  
  346. local private_settings = {}
  347. private_settings[&quot;dash&quot;] = createOption(false, mmp.changeBoolFunc, { &quot;boolean&quot; }, &quot;Use Dash?&quot;)
  348. private_settings[&quot;gallop&quot;] = createOption(false, mmp.changeBoolFunc, { &quot;boolean&quot; }, &quot;Use Gallop?&quot;)
  349. private_settings[&quot;sprint&quot;] = createOption(false, mmp.changeBoolFunc, { &quot;boolean&quot; }, &quot;Use Sprint?&quot;)
  350.  
  351.  
  352. mmp.settings = createOptionsTable(private_settings)
  353. mmp.settings.disp = mmp.echo
  354.  
  355. mmp.settings.dispOption = function(opt, val)
  356. cecho(&quot;&lt;white&gt;Use &lt;green&gt;&quot; .. opt .. &quot;&lt;white&gt;?&quot; .. string.rep(&quot; &quot;, 15 - opt:len()) .. tostring(val.value) .. &quot;\n&quot;)
  357. end
  358.  
  359. mmp.settings.dispDefaultWriteError = function()
  360. mmp.echo(&quot;Please use the mconfig alias to set options!\n&quot;)
  361. end
  362.  
  363. mmp.firstRun = false
  364. end
  365.  
  366. -- moves to the next room we need to.
  367. function mmp.move()
  368. if mmp.paused or not mmp.autowalking or mmp.movetimer then return end
  369.  
  370. send(speedWalkDir[speedWalkCounter], false)
  371. cecho(string.format(&quot;&lt;red&gt;(&lt;maroon&gt;%d - &lt;dark_slate_grey&gt;%s&lt;red&gt;)&quot;, #speedWalkDir - speedWalkCounter + 1, speedWalkDir[speedWalkCounter]))
  372.  
  373. -- timeout
  374. --if mmp.movetimer then killTimer(mmp.movetimer) end
  375. mmp.movetimer = true
  376. tempTimer(tonumber(getNetworkLatency())+0.5, [[mmp.movetimer = false; mmp.move()]] )
  377. end
  378.  
  379. function mmp.stop()
  380. speedWalkPath = {}
  381. speedWalkDir = {}
  382. speedWalkCounter = 0
  383. stopStopWatch(speedWalkWatch)
  384. if speedWalkTimerID then killTimer( speedWalkTimerID ) end
  385. mmp.autowalking = false
  386.  
  387. mmp.echo(&quot;Stopped walking.&quot;)
  388. end
  389.  
  390. local oldnum
  391. function speedwalking( event, num )
  392. local num = tonumber(num) or tonumber(gmcp.Room.Info.num)
  393. mmp.currentroom = num
  394.  
  395. -- workaround for Aetolia spamming us with multiple nums per room
  396. --if oldnum == num or not mmp.autowalking then return else oldnum = num end
  397. --if mmp.movetimer then killTimer(mmp.movetimer) end
  398.  
  399. --if mmp.movetimer then killTimer(mmp.movetimer); mmp.movetimer = false end
  400. if num == speedWalkPath[#speedWalkPath] then
  401. local walktime = stopStopWatch(speedWalkWatch)
  402. mmp.echo(string.format(&quot;We've arrived! Took us %.1fs.\n&quot;, walktime))
  403. raiseEvent(&quot;mmapper arrived&quot;)
  404. speedWalkPath = {}
  405. speedWalkDir = {}
  406. speedWalkCounter = 0
  407. mmp.autowalking = false
  408. elseif speedWalkPath[speedWalkCounter] == num then
  409. speedWalkCounter = speedWalkCounter + 1
  410. mmp.move()
  411. elseif #speedWalkPath&gt; 0 then -- ended up somewhere we didn't want to be?
  412. speedWalkMoved = false
  413.  
  414. -- re-calculate path then
  415. mmp.echo(&quot;Ended up off the path, recalculating a new path...&quot;)
  416. local destination = speedWalkPath[#speedWalkPath]
  417. if not getPath(num, destination) then
  418. mmp.echo(string.format(&quot;Don't know how to get to %d (%s) anymore :(&quot;,
  419. destination, mmp.searchRoom(destination)))
  420. else
  421. speedWalkCounter = 1; mmp.move()
  422. end
  423. end
  424. end
  425.  
  426. function mmp.gotoRoom (where, dashtype)
  427. mmp.movetimer = false
  428. if not where or not tonumber(where) then
  429. mmp.echo(&quot;Where do you want to go to?&quot;) return end
  430.  
  431. if tonumber(where) == mmp.currentroom then
  432. mmp.echo(&quot;We're already at &quot;..where..&quot;!&quot;)
  433. raiseEvent(&quot;mmapper arrived&quot;)
  434. return
  435. end
  436.  
  437. if not getPath(mmp.currentroom, tonumber(where)) then
  438. mmp.echo(&quot;Don't know how to get there from here :(&quot;)
  439. speedWalkPath = {}
  440. speedWalkDir = {}
  441. speedWalkCounter = 0
  442. raiseEvent(&quot;mmapper failed path&quot;)
  443. return
  444. end
  445.  
  446. doSpeedWalk(dashtype)
  447. end
  448.  
  449. function doSpeedWalk(dashtype)
  450. resetStopWatch(speedWalkWatch)
  451. startStopWatch(speedWalkWatch)
  452. if mmp.settings[&quot;gallop&quot;] or mmp.settings[&quot;dash&quot;] or mmp.settings.sprint or dashtype then
  453. mmp.fixPath(mmp.currentroom, speedWalkPath[#speedWalkPath],
  454. (mmp.settings[&quot;gallop&quot;] and &quot;gallop&quot;) or (mmp.settings[&quot;dash&quot;] and &quot;dash&quot;) or (mmp.settings.sprint and &quot;sprint&quot;) or dashtype)
  455. end
  456.  
  457. if #speedWalkPath == 0 then
  458. mmp.echo(&quot;Couldn't find a path to the destination :(&quot;)
  459. raiseEvent(&quot;mmapper failed path&quot;)
  460. return
  461. end
  462.  
  463. mmp.autowalking = true
  464.  
  465. -- this is a fix: convert nums to actual numbers
  466. for i = 1, #speedWalkPath do
  467. speedWalkPath[i] = tonumber(speedWalkPath[i])
  468. end
  469.  
  470. if not mmp.paused then
  471. mmp.echo(&quot;Starting speedwalk from &quot;..(atcp.RoomNum or gmcp.Room.Info.num)..&quot; to &quot;) echoLink(speedWalkPath[#speedWalkPath], 'gotoRoom &quot;' .. speedWalkPath[#speedWalkPath].. '&quot;', 'Go to ' .. speedWalkPath[#speedWalkPath]) echo(&quot;: &quot;)
  472. speedWalkCounter = 1
  473. mmp.move()
  474. else
  475. mmp.echo(&quot;Will go to &quot;..speedWalkPath[#speedWalkPath]..&quot; as soon as the mapper is unpaused.&quot;)
  476. end
  477. end
  478.  
  479. function mmp.failpath()
  480. local walktime = stopStopWatch(speedWalkWatch)
  481. mmp.echo(string.format(&quot;Can't continue further! Took us %.1fs to get here.\n&quot;, walktime))
  482. raiseEvent(&quot;mmapper failedpath&quot;)
  483. speedWalkPath = {}
  484. speedWalkDir = {}
  485. speedWalkCounter = 0
  486. killTimer( speedWalkTimerID )
  487. end
  488.  
  489. function mmp.changeBoolFunc(name, option)
  490. local en
  491. if option then en = &quot;will now use&quot; else en = &quot;will no longer use&quot; end
  492. mmp.echo(&quot;&lt;green&gt;Okay, the mapper &quot; .. en .. &quot; &lt;white&gt;&quot; .. name .. &quot;&lt;green&gt;!\n&quot;)
  493. end
  494.  
  495. function mmp.fixPath(rFrom,rTo,dashtype)
  496. local currentPath, currentIds = {}, {}
  497. local dRef = {[&quot;n&quot;] = &quot;north&quot;, [&quot;e&quot;] = &quot;east&quot;, [&quot;s&quot;] = &quot;south&quot;, [&quot;w&quot;] = &quot;west&quot;}
  498. if not getPath(rFrom,rTo) then return false end
  499.  
  500. -- Logic: Look for a direction repeated at least two times.
  501. -- count the number of times it repeats, then look that many rooms ahead.
  502. -- if that room also contains the direction we're headed, just travel that many directions.
  503. -- otherwise, dash.
  504.  
  505. local repCount = 1
  506. local index = 1
  507. local dashExaust = false
  508. while speedWalkDir[index] do
  509. dashExaust = false
  510. repCount = 1
  511. while speedWalkDir[index+repCount] == speedWalkDir[index] do
  512. repCount = repCount + 1
  513. if repCount == 11 then
  514. dashExaust = true
  515. break
  516. end
  517. end
  518. if repCount &gt; 1 then
  519. -- Found direction repitition. Calculate dash path.
  520. local exits = getRoomExits(speedWalkPath[index+(repCount-1)])
  521. local pname = &quot;&quot;
  522. for word in speedWalkDir[index]:gmatch(&quot;%w&quot;) do pname = pname .. (dRef[word] or word) end
  523. if not exits[pname] or dashExaust then
  524. -- Final room in this direction does not continue, dash!
  525. table.insert(currentPath,string.format(&quot;%s %s&quot;,dashtype,speedWalkDir[index]))
  526. currentIds[#currentIds+1] = speedWalkPath[index+repCount-1]
  527. else
  528. -- Final room in this direction continues onwards, don't dash
  529. for i = 1,repCount do
  530. table.insert(currentPath,speedWalkDir[index])
  531. currentIds[#currentIds+1] = speedWalkPath[index]
  532. end
  533. end
  534. index = index + repCount
  535. else
  536. -- No repetition, just add the direction.
  537. table.insert(currentPath,speedWalkDir[index])
  538. currentIds[#currentIds+1] = speedWalkPath[index]
  539. index = index + 1
  540. end
  541. end
  542.  
  543. speedWalkDir = currentPath
  544. speedWalkPath = currentIds
  545. return true
  546. end
  547. mmp.startup()
  548. </script>
  549. <eventHandlerList>
  550. <string>RoomNum</string>
  551. <string>gmcp.Room</string>
  552. </eventHandlerList>
  553. </Script>
  554. <Script isActive="yes" isFolder="no">
  555. <name>Utilities</name>
  556. <script>function mmp.echo(what)
  557. moveCursorEnd(&quot;main&quot;) if getCurrentLine() ~= &quot;&quot; then echo&quot;\n&quot; end
  558. decho(&quot;&lt;112,229,0&gt;(&lt;73,149,0&gt;mapper&lt;112,229,0&gt;): &lt;255,255,255&gt;&quot;)
  559. cecho(what)
  560. end
  561.  
  562. function mmp.deleteLineP()
  563. deleteLine()
  564. tempLineTrigger(1,1,[[
  565. if isPrompt() then deleteLine() end
  566. ]])
  567. end
  568.  
  569. function mmp.pause(what)
  570. assert(what == nil or what == &quot;on&quot; or what == &quot;off&quot;, &quot;mmp.pause wants 'on', 'off' or nothing as an argument&quot;)
  571.  
  572. if what == &quot;on&quot; or (what == nil and not mmp.paused) then
  573. mmp.paused = true
  574. elseif what == &quot;off&quot; or (what == nil and mmp.paused) then
  575. mmp.paused = false
  576. end
  577.  
  578. mmp.echo(&quot;Speedwalking &quot; .. (mmp.paused and &quot;paused&quot; or &quot;unpaused&quot;) .. &quot;.&quot;)
  579. if not mmp.paused then mmp.move() end
  580. end
  581.  
  582. function mmp.getnums(roomname)
  583. local t = mmp.searchRoom(roomname)
  584.  
  585. if not next(t) then
  586. return nil end
  587.  
  588. local result = {}
  589.  
  590. for k,v in pairs(t) do
  591. result[#result+1] = tonumber(v) end
  592.  
  593. return result
  594. end
  595.  
  596. -- for a given room name, we'll echo all the vnums
  597. function mmp.echonums(roomname)
  598. local t = mmp.searchRoom(roomname)
  599.  
  600. if not next(t) then
  601. echo &quot;?&quot; return nil end
  602.  
  603. -- transform the kv table into a table of tables for cleaner code.
  604. -- + perhaps Mudlet in future will give this us anyway, sorted by relevancy
  605. local dt = {}
  606. for k,v in pairs(t) do dt[#dt+1] = {name = k, id = v} end
  607.  
  608. -- display first three ids. Can't really nicely table.concat them.
  609. echoLink(dt[1].id, 'mmp.gotoRoom('..dt[1].id..')', string.format(&quot;Go to %s (%s)&quot;, dt[1].id, dt[1].name))
  610. if not dt[2] then return end
  611.  
  612. echo&quot;, &quot;
  613. echoLink(dt[2].id, 'mmp.gotoRoom('..dt[2].id..')', string.format(&quot;Go to %s (%s)&quot;, dt[2].id, dt[2].name))
  614. if not dt[3] then return end
  615.  
  616. echo&quot;, &quot;
  617. echoLink(dt[3].id, 'mmp.gotoRoom('..dt[3].id..')', string.format(&quot;Go to %s (%s)&quot;, dt[3].id, dt[3].name))
  618. if not dt[4] then return end
  619.  
  620. echo&quot;, ...&quot;
  621. end
  622.  
  623. -- searchRoom with a cache!
  624. local cache = {}
  625. setmetatable(cache, {__mode = &quot;kv&quot;}) -- weak keys/values = it'll periodically get cleaned up by gc
  626.  
  627. function mmp.searchRoom(what)
  628. local result = cache[what]
  629. if not result then
  630. result = searchRoom(what)
  631. cache[what] = result
  632. end
  633. return result
  634. end
  635.  
  636. function mmp.roomFind(query)
  637. local result = mmp.searchRoom(query)
  638.  
  639. if type(result) == &quot;string&quot; then
  640. cecho(&quot;&lt;grey&gt;You have no recollection of any room with that name.&quot;) return end
  641.  
  642. for roomname, roomid in pairs(result) do roomid = tonumber(roomid)
  643. cecho(string.format(&quot;&lt;grey&gt;You remember the room '%s' (%d) in the %s.\n&quot;,
  644. roomname, roomid, mmp.areatabler[getRoomArea(roomid)]
  645. ))
  646. end
  647. cecho(string.format(&quot; &lt;grey&gt;%d rooms found.\n&quot;, table.size(result)))
  648. end
  649.  
  650. -- cached data
  651. mmp.areatable = getAreaTable() -- this translates an area name to an ID
  652. mmp.areatabler = {} -- this translates an ID to an area name
  653.  
  654. local t = getAreaTable()
  655. for k,v in pairs(t) do
  656. mmp.areatabler[tonumber(v)] = k
  657. end
  658.  
  659. t = nil</script>
  660. <eventHandlerList/>
  661. </Script>
  662. <Script isActive="yes" isFolder="no">
  663. <name>Person tracking</name>
  664. <script>mmp.pdb = mmp.pdb or {}</script>
  665. <eventHandlerList/>
  666. </Script>
  667. <Script isActive="yes" isFolder="no">
  668. <name>Create Option Table</name>
  669. <script>-------------------------------------------------
  670. -- Put your Lua functions here. --
  671. -- --
  672. -- Note that you can also use external Scripts --
  673. -------------------------------------------------
  674.  
  675. function createOption(startingValue, onChangeFunc, allowedVarTypes, use)
  676. if allowedVarTypes then -- make sure our starting Value follows type rules
  677. if not table.contains(allowedVarTypes, type(startingValue)) then
  678. echo(&quot;Starting type is not of allowed type!\n&quot;)
  679. display(allowedVarTypes)
  680. echo(&quot;type: &quot; .. type(startingValue) .. &quot;\n&quot;)
  681. return
  682. end
  683. end
  684.  
  685. local option = {
  686. value = startingValue,
  687. onChange = onChangeFunc,
  688. allowedVarTypes = allowedVarTypes,
  689. use = use or &quot;&quot;
  690. }
  691.  
  692. return option
  693. end
  694.  
  695. function createOptionsTable(defaultTable)
  696. local index = {} -- index to store the default table at in our proxy table
  697.  
  698.  
  699. local proxyTable = {} -- This is the table that is returned to the user
  700.  
  701. proxyTable.disp = echo
  702.  
  703. proxyTable.dispDefaultWriteError = function()
  704. echo(&quot;Can't overwrite default options. Please use the SetOption function to change the value\n&quot;)
  705. end
  706.  
  707. proxyTable.dispOption = function(opt, val)
  708. if not opt or not val then return end
  709. echo(&quot;Name: &quot; .. string.title(opt) .. string.rep(&quot; &quot;, 10 - string.len(opt)))
  710. echo(&quot;Val: &quot; .. tostring(val.value))
  711. echo(string.rep(&quot; &quot;, 10 - string.len(tostring(val.value))) .. &quot;- &quot; .. val.use .. &quot;\n&quot;)
  712. end
  713.  
  714. function proxyTable:showAllOptions()
  715. proxyTable.disp(&quot;Available options: \n&quot;)
  716. for k, v in pairs(self[index]) do
  717. self.dispOption(k, v)
  718. end
  719. echo(&quot;\n&quot;)
  720. for k, v in pairs(self[&quot;_customOptions&quot;]) do
  721. self.dispOption(k, v)
  722. end
  723.  
  724. end
  725.  
  726. function proxyTable:setOption(option, value)
  727. if self[option] == nil then
  728. proxyTable.disp(&quot;No such option!\n&quot;)
  729. return
  730. end
  731.  
  732. -- otherwise, set the option
  733. if self[&quot;_customOptions&quot;][option] then
  734. if not table.contains(self[&quot;_customOptions&quot;][option].allowedVarTypes, type(value)) then
  735. proxyTable.disp(&quot;You can't set '&quot; .. option .. &quot;' to that!\n&quot;)
  736. return
  737. end
  738. self[&quot;_customOptions&quot;][option].value = value
  739. if self[&quot;_customOptions&quot;][option].onChange then
  740. self[&quot;_customOptions&quot;][option].onChange(option, value)
  741. end
  742. else
  743. if not table.contains(self[index][option].allowedVarTypes, type(value)) then
  744. proxyTable.disp(&quot;You can't set '&quot; .. option .. &quot;' to that!\n&quot;)
  745. return
  746. end
  747. rawset(self[index][option], &quot;value&quot;, value)
  748. local opt = rawget(self[index], option)
  749. if opt.onChange then opt.onChange(option, value) end
  750. end
  751.  
  752. if value.onChange then value.onChange(option, value) end
  753. end
  754.  
  755.  
  756. proxyTable._customOptions = {}
  757.  
  758. local mt = {
  759. __index = function(t, k)
  760. local custOp = rawget(t, &quot;_customOptions&quot;)
  761. if custOp[k] then
  762. local opt = custOp[k]
  763. if opt then return opt.value else return nil end
  764. else
  765. local opt = t[index][k]
  766. if opt then return opt.value else return nil end
  767. end
  768. end,
  769.  
  770. __newindex = function (t, k, v)
  771. if t[index][k] then
  772. proxyTable.dispDefaultWriteError()
  773. else
  774. t[&quot;_customOptions&quot;][k] = v
  775. end
  776. end
  777. }
  778.  
  779.  
  780. proxyTable[index] = defaultTable
  781.  
  782. setmetatable(proxyTable, mt)
  783.  
  784. return proxyTable
  785.  
  786. end</script>
  787. <eventHandlerList/>
  788. </Script>
  789. <Script isActive="yes" isFolder="no">
  790. <name>Lock Area</name>
  791. <script>
  792.  
  793. mmp.locked = mmp.locked or {}
  794. mmp.lastLockSearch = nil
  795.  
  796. function mmp.doLockArea(search)
  797. local areaList
  798. if search ~= nil then
  799. local r = rex.new(string.lower(search))
  800. mmp.lastLockSearch = search
  801. for name, id in pairs(getAreaTable()) do
  802. if r:match(string.lower(name)) then
  803. areaList = areaList or {}
  804. areaList[name] = id
  805. end
  806. end
  807. if areaList == nil then
  808. mmp.echo(&quot;'&quot; .. search .. &quot;' did not match any known areas!&quot;)
  809. return
  810. end
  811. else
  812. mmp.lastLockSearch = nil
  813. areaList = getAreaTable()
  814. end
  815.  
  816. for name, id in pairs(areaList) do
  817. mmp.echo(name .. string.rep(&quot; &quot;, 40 - string.len(name)))
  818. if not mmp.locked[id] then
  819. setFgColor(0, 200, 0)
  820. setUnderline(true)
  821. echoLink(&quot;Lock!&quot;, [[mmp.lockArea( ']] .. name .. [[', true )]], &quot;Click to lock area '&quot; .. name .. &quot;'&quot;, true)
  822. else
  823. setFgColor(200, 0, 0)
  824. setUnderline(true)
  825. echoLink(&quot;Unlock!&quot;, [[mmp.lockArea( ']] .. name .. [[', false )]], &quot;Click to unlock area '&quot; .. name .. &quot;'&quot;, true)
  826. end
  827. end
  828. end
  829.  
  830. function mmp.lockArea(name, lock)
  831. local areas = getAreaTable()
  832. local rooms = getAreaRooms(areas[name])
  833. for _, room in ipairs(rooms) do
  834. lockRoom(room, lock)
  835. end
  836.  
  837. mmp.locked[areas[name]] = lock and true or nil
  838. if lock then
  839. mmp.echo(&quot;Area '&quot; .. name .. &quot;' locked!&quot;)
  840. else
  841. mmp.echo(&quot;Area '&quot; .. name .. &quot;' unlocked!&quot;)
  842. end
  843.  
  844. mmp.doLockArea(mmp.lastLockSearch)
  845. end
  846.  
  847.  
  848. </script>
  849. <eventHandlerList/>
  850. </Script>
  851. <Script isActive="yes" isFolder="no">
  852. <name>Center view via GMCP</name>
  853. <script></script>
  854. <eventHandlerList/>
  855. <Script isActive="yes" isFolder="no">
  856. <name>mmp_center_roominfo</name>
  857. <script>function mmp_center_roominfo()
  858. centerview(gmcp.Room.Info.num)
  859. echo(&quot;\nroomID=&quot;..gmcp.Room.Info.num..&quot;\n&quot;)
  860. end</script>
  861. <eventHandlerList>
  862. <string>gmcp.Room</string>
  863. </eventHandlerList>
  864. </Script>
  865. </Script>
  866. </ScriptGroup>
  867. </ScriptPackage>
  868. <KeyPackage/>
  869. </MudletPackage>
RAW Paste Data