JS.Grid_ClearAllLayers()
Grid_LoadSvg ("map.svg", "map")
Grid_SetCentre (0,0)
JS.Grid_ShowCustomLayer(true)
JS.Grid_DrawSvg ("map", "mapid", 0, 0, 5, 5)
Loads and SVG file and associates it with an id, so it can subsequently be drawn on the custom grid drawing layer using Grid_DrawSvg.
The data parameter is the raw file data for the SVG file - you can load a string with file data using the GetFileData function.
url = GetFileURL("map.svg")
svg_data = GetFileData(url)
Grid_LoadSvg(svg_data)
svg_data = GetFileData("map.svg")
Grid_LoadSvg(svg_data)
<svg height="100" width="100">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
JS.Grid_ClearAllLayers()
Grid_ShowCustomLayer(true)
Grid_SetCentre (0,0)
svgdata = GetFileData(GetFileUrl("map.svg"))
Error running script: Error evaluating expression 'GetFileData(GetFileUrl("map.svg"))': Cannot find a file called 'quest://local/map.svg?c=81551578' in current path or application/resource path
JS.Grid_ClearAllLayers ()
Grid_ShowCustomLayer (true)
Grid_SetCentre (0, 0)
svgdata = GetFileData("map.svg")
Grid_LoadSvg ("svgdata", "svgid")
Grid_DrawSvg ("svgid", "svgsymbolid", 0, 0, 5, 5)
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="green" />
<svg>
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="green" />
</svg>