Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(release 30) update default scripts (IRE, 3k mappers) #400

Merged
merged 3 commits into from Mar 5, 2017

Conversation

vadi2
Copy link
Member

@vadi2 vadi2 commented Mar 4, 2017

Updated scripts included with Mudlet to their latest versions from original source repositories.

@vadi2 vadi2 requested a review from SlySven March 4, 2017 13:04
@vadi2 vadi2 added the 1 - Ready label Mar 4, 2017
@vadi2
Copy link
Member Author

vadi2 commented Mar 4, 2017

@keneanung this'll bring up mudlet-mapper script from the version 5 years ago to latest as well.

@@ -228,17 +229,19 @@ send(&quot;look&quot;)</script>
<colorTriggerFgColor>#000000</colorTriggerFgColor>
<colorTriggerBgColor>#000000</colorTriggerBgColor>
<regexCodeList>
<string>You cannot go</string>
<string>You cannot go (west|east|south|north|up|down|northeast|northwest|southwest|southeast).$</string>
<string>You cannot get it up.$</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, perhaps, an unfortunate phrase. 🤣

</regexCodePropertyList>
</Trigger>
<Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
<name>Too dark</name>
<script>tmap.roomEntered = true
if tmap:mapon() then
tmap:echo(&quot;TURN ON A LIGHT!!!!!!!!&quot;)
tmap:echo(&quot;\nMAPPING IN THE DARK. TURN ON A LIGHT!!!!!!!!\n&quot;)
Copy link
Member

@SlySven SlySven Mar 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps:
tmap:echo(&quot;\nYou can't see anything, yet you want to go MAPPING IN THE DARK? TURN ON A LIGHT!!!!!!!!\n&quot;) 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a third-party that we include in Mudlet, won't be doing any modifications to it. Source is at https://github.com/Chris7/3k-Scripts if you're keen.

@@ -438,8 +443,12 @@ end</script>
<Alias isActive="yes" isFolder="no">
<name>Show Exits</name>
<script>--show room exits
tmap:echo(getRoomExits(tmap.lastId))
tmap:echo(&quot;special exits:\n&quot;)
local exits = getRoomExits(tmap.lastId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getRoomExits( roomId ) returns nothing if the room does not exist - so that means exits will be nil in that case. Do you need to have a check for that?

for k,v in pairs(exits) do
echo(&quot; &quot; .. k .. &quot; -&gt; &quot; .. v .. &quot;\n&quot;)
end
tmap:echo(&quot;Special Exits:\n&quot;)
tmap:echo(getSpecialExitsSwap(tmap.lastId))</script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, getSpecialExitsSwap( roomId ) also returns nil on invalid roomId...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oy... all issues to file at https://github.com/Chris7/3k-Scripts if you'd like. I didn't write this script, just updating it to latest, we're already shipping it with Mudlet!

<script>--renames current area
local Name = matches[2]
local cArea = getRoomArea(tmap.lastId)
setAreaName( cArea, Name )</script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the enforced uniqueness of area names, setAreaName( oldArea, newArea ) now accepts an existing area name as a string for oldArea BTW...

<script>local aid = getRoomArea(tmap.lastId)
local rooms = getAreaRooms(aid)
for i,v in pairs(rooms) do
local stubs = getExitStubs(v)
Copy link
Member

@SlySven SlySven Mar 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getExitStubs( roomId ) starts its listing with a 0 - but there is now getExitStubs1( roomId ) which does the correct thing for a lua table and starts at 1 for the first entry.

It returns a list of numbers corresponding to the exit direction codes (1 to 12).

local stubs = getExitStubs(v)
if stubs and type(stubs) == 'table' then
for j,k in pairs(stubs) do
connectExitStub(v,k)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I note in comment 6 bug 1114594 this only works where the first argument is the fromRoomId and the second argument is a direction code (1 to 12) or a specific exit command string. In this case it IS so WILL work. 😌

<script>if not matches[2] then
tmap:echo(&quot;Syntax: tmap deleteArea area name&quot;)
else
local atable = getAreaTableSwap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLuaInterpreter::deleteArea(...) is now fully working and will take an existing area name as a string to delete. The code here is, I think, redundant.

🪲 However, there is a nasty corner case in that deleteArea(...) called with the same string as TRoomDB::mDefaultAreaName may delete the -1 area (I'll have to check more deeply), which does not sound good! 😱

elseif needed == &quot;number&quot; then
return tonumber(val)
elseif needed == &quot;string&quot; then
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something missing here? 😕

tmap:echo(string.format(&quot;Created new label #%d '%s' in %s.&quot;, lid, message, getRoomAreaName(getRoomArea(room))))
local labels = getRoomUserData(room, &quot;mapLabels&quot;)
local labelRep = tostring(getRoomArea(room))..'.'..tostring(lid)
--labels is structured like: dir|||id|||label|||x,y,z offset|||fg|||bg!&amp;!dir2|||id|||label|||xyz...
-- local lTable = string.split(labels,'!&amp;!')
if labels ~= &quot;&quot; then
if labels ~= &quot;&quot; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here?

</regexCodePropertyList>
</Trigger>
<Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
<name>Stop (angel presences</name>
<script>setTriggerStayOpen(&quot;Angel presences&quot;, 0)
<name>Stop (angel presences)</name>
Copy link
Member

@SlySven SlySven Mar 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should be <name>Stop (angel/demon) presences</name>?


if not statusnum then mmp.echo(&quot;Unrecognized option - a door can be open, closed, locked or gone.&quot;) return end

setDoor(room, direction, statusnum)
Copy link
Member

@SlySven SlySven Mar 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now returns true if a change was effected, false if there was no actual change (but the command was valid e.g. setting an open door when there was already a door of that type set) or nil + error message if there is a problem...! This could make the following message only report if a change was made.

@@ -3186,58 +3769,131 @@ end

if not area then mmp.echo(matches[3]..&quot; isn't a known area. Which one do you want to set?&quot;) return end

local tmp = getRoomUserData(1, &quot;areaContinents&quot;)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that data is not now being stored in roomId 1 at least here, has it moved to map or area userdata yet - or will it wait until we actually get to Release 3.0 (where we will update the default map format to a higher value that supports them)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how the script works to ensure maximum compatibility with most versions of Mudlet, using map userdata won't happen that soon.


local from, to = tonumber(matches[2]), tonumber(matches[3])

getPath(from, to)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget you now have the global speedWalkWeight table as well now with the weights of each step and the getPath() function also has a return value of the total weight of the route. 😃

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't documented on the Mudlet wiki - will add documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -3549,6 +4231,112 @@ end</script>
<packageName></packageName>
<regex>^room marks$</regex>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, I am giving up on looking through this, just too much to digest, I hope it all works, please indicate whether you'd prefer me to keep going... 😞

@SlySven
Copy link
Member

SlySven commented Mar 4, 2017

@vadi2 Didn't catch your indication that this is really held over on @Chris7's repository until I returned to this page - so didn't stop commenting until I gave up! 😊

@vadi2
Copy link
Member Author

vadi2 commented Mar 5, 2017 via email

@vadi2
Copy link
Member Author

vadi2 commented Mar 5, 2017

I've filed an issue at Chris7/3k-Scripts#7 to integrate your improvements. Sorry, tagging you for review was misleading - I just did that so you'd get a notification to approve the PR.

Copy link
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must remember to check for what happens for a deleteArea("Default Area") it might delete area -1 which could be bad.

@vadi2
Copy link
Member Author

vadi2 commented Mar 5, 2017

OK, give it a look. Thanks!

@vadi2 vadi2 merged commit 0a263a1 into Mudlet:release_30 Mar 5, 2017
@vadi2 vadi2 deleted the (release_30)-update-default-scripts branch March 5, 2017 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants