EC: automatically placing waypoint on map for event boss

ForeverFunForeverFun Posts: 882
edited October 29 in General Discussions
For those that are coordinate challenged, the below will automatically add a waypoint "Manifestation" marker based on the barked town crier text.  Make sure to right click and delete the waypoint when the boss has died.

Add the below to textparsing.lua, and end of function TextParsing.SpecialTexts().  Ideally, replace the TextSourceId number check with the actual objectID value of your town crier.

p.s. UO team should buff up the boss on atlantic, like 10x.  It dies in 30 seconds or so.
p.p.s UO team, the cryer doesn't bark coordinates for at least Valley of Eodon maps.


    local header = L"The ground ruptures and darkness spills forth... the Manifestation of Evil has begun to pierce the vale near "
    local found = nil

    -- replace TextSourceId with the Id number of your town cryer, to avoid spoofing.
    if( SystemData.TextSourceID ~= 0 and SystemData.TextSourceID ~= -1 ) then    -- originates from town cryer, not SYSTEM.
        found = wstring.find(senderText, header)
    end
    
    if( found ) then    -- adapted from charbydis case, note minimal error checking.
        local facet_number = nil
        local location = wstring.gsub( senderText, header, L"" )
        local coord = location

        local text2 = wstring.find(coord, L"[,]")
        local first = wstring.sub(coord, 1, text2 - 1)
        first = wstring.gsub(first, L"o ", L".")
        first = wstring.gsub(first, L"'", L"")

        local latDir = wstring.sub(first, -1)
        local latVal = wstring.sub(first,1, -2)
        
        local second = wstring.sub(coord, text2 + 2)
        second = wstring.gsub(second, L"o ", L".")
        second = wstring.gsub(second, L"'", L"")

        if( second ) then
            local facets = {}

            -- truncate string around " at " to extract trailing Direction and facet string.
            local sep = wstring.find(second, L" at ")
            local chopped = wstring.sub(second, 1, sep-1)    -- strsub (s, i, [j])  Returns another string, which is a substring of s , starting at i and runing until j .    
            
            -- extract facet from end of string.
            local tail = wstring.find(second, L" in ")            
            local facet = wstring.sub(second, tail+4)
            local del = wstring.find(facet, L"!")        

            facet = wstring.sub(facet, 0, del-1)    -- remove trailing !

            -- convert facet to number
            facets = {[L"Felucca"]=0, [L"Trammel"]=1, [L"Ilshenar"]=2, [L"Malas"]=3, [L"Tokuno"]=4, [L"Ter Mur"]=5}    -- only trammel, malas verified.            
            facet_number = facets[facet]
            
            second = chopped    -- update string for long value extraction.
        end            
        
        local longDir = wstring.sub(second, -1)    
        local longVal = wstring.sub(second,1, -2)
        
        if( facet_number ~= nil ) then
            
            local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)        

--            Debug.PrintToChat(towstring(x) .. L" ".. towstring(y)..L" facet=".. towstring(facet_number))            

            UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 0.69 )    
            CenterScreenText.SendCenterScreenTexture("battlebegin")    -- generate notification.
            return
        end
    end


Comments

  • Arnold7Arnold7 Posts: 1,398
    Don’t understand your post.  What is textparsing.lua?  Thanks.
  • SethSeth Posts: 2,924
    edited October 30
    For EC users,
    1. Open Map 
    2. Right click create waypoint anywhere 
    3. On the pop-up window, enter the coordinates 
    4. Give the waypoint any name, e.g. "a" 
    5. Save, then expand the map to look for the bright spot.
    If it ain't broke, don't fix it. 
    ESRB warning: Some Blood. LOTS of Alcohol. Some Violence. LOTS of Bugs
  • KroDuKKroDuK Posts: 315
    edited October 30
    Seth said:
    For EC users,
    1. Open Map 
    2. Right click create waypoint anywhere 
    3. On the pop-up window, enter the coordinates 
    4. Give the waypoint any name, e.g. "a" 
    5. Save, then expand the map to look for the bright spot.
    Sound like a WAY more legit way to do it.. than the fully automated option from the OP; his for us by us option.
    So rather than recognise the effort the botters went to, to set all that up - for the benefit of the players, to help get certain items, something you could never be bothered to do, you would rather drag people backwards to your neanderthal world?
    -UO official forums, brought to you by BoardSword studio
  • ForeverFunForeverFun Posts: 882
    edited October 30

    Spoiler below has an update that takes care of "in the wilderness" location text that threw off the facet parsing.  This also adjusts the icon size on the map, so it's more visible if you have the map zoomed out.

    p.s. would the UO team change the Nightmare str/hit point range to avoid these spawning as 3 slot beasts?  I don't think anybody keeps those.


    @Mariah was working on an EC "how to" guide.

    I believe @TimSt and @Arroth_Thaiel may have posts that covers the basics of changing the EC UI.  You can look for their posts, or perhaps @Mariah may update the EC script link below.

    Most people prefer not to use scissors to cut their grass.




        local header = L"The ground ruptures and darkness spills forth... the Manifestation of Evil has begun to pierce the vale near "
        local found = nil
        -- replace (TextSourceID ~= 0 and TextSourceID ~= -1) with the Id number of your town cryer, to avoid spoofing.  SourceID will be player if they are involved in treasure hunting.
        if( (SystemData.TextSourceID == WindowData.PlayerStatus.PlayerId) or (SystemData.TextSourceID ~= 0 and SystemData.TextSourceID ~= -1) ) then    -- originates from town cryer, not SYSTEM.
            found = wstring.find(senderText, header, 1, true)
        end
        
        if( found ) then    -- adapted from charbydis case, note minimal error checking.
            local facet_number = nil
            local location = wstring.gsub( senderText, header, L"" )    -- extract trailing location data.
            local coord = location
            local text2 = wstring.find(coord, L"[,]")
            local first = wstring.sub(coord, 1, text2 - 1)
            first = wstring.gsub(first, L"o ", L".")
            first = wstring.gsub(first, L"'", L"")
            local latDir = wstring.sub(first, -1)
            local latVal = wstring.sub(first,1, -2)
            
            local second = wstring.sub(coord, text2 + 2)
            second = wstring.gsub(second, L"o ", L".")
            second = wstring.gsub(second, L"'", L"")
            if( second ) then
                -- eg. 61o 32'N, 45o 8'W at Malas in Malas!
                -- eg. 107o 45'S, 17o 26'E at a location in the wilderness in Trammel!
                local facets = {}
                -- truncate string around " at " to extract trailing Direction and facet string.
                local sep = wstring.find(second, L" at ", 1, true)
                local chopped = wstring.sub(second, 1, sep-1)    -- strsub (s, i, [j])  Returns another string, which is a substring of s , starting at i and runing until j .    
                
                -- extract facet from end of string.
                local tail = wstring.len(second)                    -- find terminal !
                local facet = wstring.sub(second, tail-12)            -- extract based on longest possible facet name.
                
                tail = wstring.find(facet, L" in ", 1, true)        -- find trailing " in "
                facet = wstring.sub(facet, tail+4)                    -- extract facet string.
                -- convert facet to number
                facets = {[L"Felucca!"]=0, [L"Trammel!"]=1, [L"Ilshenar!"]=2, [L"Malas!"]=3, [L"Tokuno!"]=4, [L"Ter Mur!"]=5}    -- only trammel, malas verified.            
                facet_number = facets[facet]
                
                second = chopped    -- update string for long value extraction.
            end            
            
            local longDir = wstring.sub(second, -1)    
            local longVal = wstring.sub(second,1, -2)
            
            if( facet_number ~= nil ) then
                
                local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)        
    --            Debug.PrintToChat(towstring(x) .. L" ".. towstring(y)..L" facet=".. facet.. L" ".. towstring(facet_number))            
                UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 1.50 )        -- was 0.69
                CenterScreenText.SendCenterScreenTexture("battlebegin")    -- generate notification.
                return
            end
        end

  • MariahMariah Posts: 3,211Moderator
    edited October 30
    The page I was making isn't strictly speaking a 'how to' guide, it was just some simple changes that can be made fairly easily by someone with little knowledge (ie me! )
    I started reading some of the threads on the forum, and by the time one had posted a piece of code, someone else had offered a change, then the there was a 're-think' and I ended up lost and not knowing what to actually put in the wiki!


  • TimStTimSt Posts: 1,861
    For the EC map I suggest making the following changes to make the coordinates on the map easier to read.
    To source\mapwindow.xml
    Change the line 308 from
    <Label name="$parentCoordsText" font="Arial_Black_Shadow_12" maxchars="64" textalign="left" handleinput="false" wordwrap ="true">
    to
    <Label name="$parentCoordsText" font="Arial_Black_Shadow_15" maxchars="64" textalign="left" handleinput="false" wordwrap ="true">
    and change the line 319 from
    <Label name="$parentPlayerCoordsText" font="Arial_Black_Shadow_12" maxchars="128" textalign="right" handleinput="false" wordwrap ="true">
    to
    <Label name="$parentPlayerCoordsText" font="Arial_Black_Shadow_15" maxchars="128" textalign="right" handleinput="false" wordwrap ="true">



  • ForeverFunForeverFun Posts: 882
    TimSt said:
    For the EC map I suggest making the following changes to make the coordinates on the map easier to read.
    To source\mapwindow.xml


    Good change, thanks!
  • firecfirec Posts: 22
    I am a mapper, how would I get it to appear from what appears above my head and not the crier?
  • ForeverFunForeverFun Posts: 882
    Interesting, the syntax for the string given to mappers is flipped around.

    Here's an update that takes care of that, and also changes how the coordinates are extracted (wstring.match).

        local header = L"The ground ruptures and darkness spills forth... the Manifestation of Evil has begun to pierce the vale near "
        local found = nil

        -- replace (TextSourceID ~= 0 and TextSourceID ~= -1) with the Id number of your town cryer, to avoid spoofing.  SourceID will be player if they are involved in treasure hunting.
        if( (SystemData.TextSourceID == WindowData.PlayerStatus.PlayerId) or (SystemData.TextSourceID ~= 0 and SystemData.TextSourceID ~= -1) ) then    -- originates from town cryer/player, not SYSTEM.
            found = wstring.find(senderText, header, 1, true)
        end
        
        if ( found ) then    -- adapted from charbydis case, note minimal error checking.
            -- eg. 61o 32'N, 45o 8'W at Malas in Malas!
            -- eg. 107o 45'S, 17o 26'E at a location in the wilderness in Trammel! (town cryer order)
            -- eg. a forest outside Skara Brae at 26o 37'S, 30o 52'W in Trammel!   (treasure map hunter notification, flipped area order)
            local facet_number = nil
            local coord = wstring.match(senderText, L"%d+[o]%s%d+['][NS][,].*%d+[o]%s%d+['][EW]")    -- extract the coordinates per rigid syntax.  note ".*" search pattern at long/lat, appears there may be alternate whitespace/control character(s) in the middle.
            
            local latDir
            local latVal
            local longDir
            local longVal
            
            if( coord ~= nil ) then
                local text2 = wstring.find(coord, L"[,]")
                first = wstring.sub(coord, 1, text2-1)
            
                first = wstring.gsub(first, L"o ", L".")
                first = wstring.gsub(first, L"'", L"")

                latDir = wstring.sub(first, -1)
                latVal = wstring.sub(first,1, -2)
                
                local second = wstring.sub(coord, text2 + 2)
                second = wstring.gsub(second, L"o ", L".")
                second = wstring.gsub(second, L"'", L"")
            
                longDir = wstring.sub(second, -1)    
                longVal = wstring.sub(second,1, -2)                
                
                -- extract facet from end of string.

                local tail = wstring.len(senderText)                    
                local facet = wstring.sub(senderText, tail-12)        -- extract from tail based on longest possible facet name.
                
                tail = wstring.find(facet, L" in ", 1, true)        -- find trailing " in "
                
                if( tail ~= nil ) then
                    facet = wstring.sub(facet, tail+4)                -- extract facet string.

                    -- convert facet to number
                    local facets = {[L"Felucca!"]=0, [L"Trammel!"]=1, [L"Ilshenar!"]=2, [L"Malas!"]=3, [L"Tokuno!"]=4, [L"Ter Mur!"]=5}    -- only trammel, malas verified.            
                    facet_number = facets[facet]
                end
            end
            
            if( facet_number ~= nil ) then
                local x,y = MapCommon.ConvertToXYMinutes(tonumber(latVal), tonumber(longVal), latDir, longDir, 1, 1)    

                if( x ~= nil and y ~= nil ) then
                    UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 1.50 )    -- was 0.69        
                    CenterScreenText.SendCenterScreenTexture("battlebegin")
    --                Debug.PrintToChat(L"Manifestation: ".. towstring(x).. L","..towstring(y)..L" facet:".. towstring(facet_number))
                end
                
                return            
            end
        end


  • ForeverFunForeverFun Posts: 882
    A little QoL improvement to the QoL improvement.  Automatically switches the map window to the facet where the boss is, centered on the coordinates in question.  Just adjust this block of code from the last "spoiler" post.

                if( x ~= nil and y ~= nil ) then
                    UOCreateUserWaypoint( MapCommon.WaypointCustomType, x, y, facet_number, L"Manifestation" .. L"_ICON_100010_SCALE_" .. 1.50 )    -- was 0.69        
                    CenterScreenText.SendCenterScreenTexture("battlebegin")
    --                Debug.PrintToChat(L"Manifestation: ".. towstring(x).. L","..towstring(y)..L" facet:".. towstring(facet_number))
                    -- new code follows to switch the map to the facet in question, centered on the x,y coordinates.
                    MapWindow.CenterOnPlayer = false
                    ButtonSetPressedFlag( "MapWindowCenterOnPlayerButton", false )
                    UORadarSetCenterOnPlayer( false )
                    -- change map facet and center x,y position.
                    UOCenterRadarOnLocation(x, y, facet_number, 0, false)
                    MapCommon.UpdateZoomValues(facet_number, 0)
                    MapCommon.AdjustZoom(0)    
                end

Sign In or Register to comment.