Sequential Numbering Script?

Hi folks,
Pardon me for being too lazy to open up the scripting pdf, but is there a plugin that will place sequential numbers on a map?

I've got the map, and now I would just like to click ->1, click-> 2, etc.

thanks,
J

Comments

  • No, not that I'm aware of.

    Here's a very quick and hacky custom tool (extra emphasis on very and hacky) based on the Random City Name tool that places an incremented label every time the map is clicked. You'd need to tweak the font size to whatever is appropriate for your map. So try it on a blank map of the same size first.

    Save this as LabelCounter.FMScript in the /Plugins directory and restart FM. It'll show up on the Custom Tools palette (though it uses the same icon as the random city name, so you'll have to hover over the tools to see which is which).

    #author             NBOS Software
    #desc               Increments a label as the map is clicked
    #customtool         Label Counter
    #toolbase           Circle
    #toolset            Custom Tools
    #button         RandomCityName.bmp
    
    Dim o, oT
    Dim n, m
    Dim CitySize
    Dim x, y
    Dim sLang, sFont
    Dim GroupID
    
    sFont = "Times New Roman" 
    
    o = GetLastMapObject()
    
    map = GetCurrentMap()
    
    sCnt = map.GetField( "LastCount")
    nCnt = 0
    If Len( sCnt) < 1 Then
        nCnt = 0
    Else
        nCnt = CInt( sCnt)
    End If
    
    nCnt = nCnt + 1
    
    oT = CreateMapObject( "Text")
    oT.Text = CStr( nCnt)
    
    map.SetField "LastCount", CStr( nCnt)
    
    oT.FontSize = 72 * 4000
    oT.BrushColor = rgb( 0, 0, 0)
    oT.PenColor = Rgb( 0, 0, 0)
    
    '----- Add the objects to the map
    
    oT.AddPoint o.GetPointX(1), o.GetPointY(1)
    oT.AddPoint o.GetPointX(1), o.GetPointY(1)+ 200
    
    oT.AddPoint o.GetPointX(1)+600000, o.GetPointY(1)
    oT.AddPoint o.GetPointX(1)+600000, o.GetPointY(1)+200000
    oT.FontName =  sFont
    
    '----- Delete the circle because we no longer need it
    map.DeleteObject( map.ObjectCount)
    
    '----- Add the text
    n = map.AddObject( oT)
    
  • Thanks, very much - will try this tonight!

  • Yep, works great. I adjusted the font and the pen color to suit.

    On a large dungeon map, this is a great time saver.

  • Ed, any way we can get this updated for FM9? I'm not a programmer and that stuff confuses the heck out of me.

  • edited September 2023

    It basically works as is, with a couple additional Dim statements, as FM's new Basic engine requires it all variables to be Dim'ed.

    #author             NBOS Software
    #desc               Increments a label as the map is clicked
    #customtool         Label Counter
    #toolbase           Circle
    #toolset            Custom Tools
    #button         RandomCityName.bmp
    
    Dim o, oT
    Dim n, m
    Dim CitySize
    Dim x, y
    Dim sLang, sFont
    Dim GroupID
    Dim map, sCnt
    Dim nCnt
    
    sFont = "Times New Roman" 
    
    o = GetLastMapObject()
    
    map = GetCurrentMap()
    
    sCnt = map.GetField( "LastCount")
    nCnt = 0
    If Len( sCnt) < 1 Then
        nCnt = 0
    Else
        nCnt = CInt( sCnt)
    End If
    
    nCnt = nCnt + 1
    
    oT = CreateMapObject( "Text")
    oT.Text = CStr( nCnt)
    
    map.SetField "LastCount", CStr( nCnt)
    
    oT.FontSize = 72 * 4000
    oT.BrushColor = rgb( 0, 0, 0)
    oT.PenColor = Rgb( 0, 0, 0)
    
    '----- Add the objects to the map
    
    oT.AddPoint o.GetPointX(1), o.GetPointY(1)
    oT.AddPoint o.GetPointX(1), o.GetPointY(1)+ 200
    
    oT.AddPoint o.GetPointX(1)+600000, o.GetPointY(1)
    oT.AddPoint o.GetPointX(1)+600000, o.GetPointY(1)+200000
    oT.FontName =  sFont
    
    '----- Delete the circle because we no longer need it
    map.DeleteObject( map.ObjectCount)
    
    '----- Add the text
    n = map.AddObject( oT)
    

    You have to come up with your own bitmap icon though (16x16 I believe)

Leave a Comment