User Tools

Site Tools


misc_func

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
misc_func [2022/06/19 15:47] adminmisc_func [2025/02/25 22:20] (current) – external edit 127.0.0.1
Line 67: Line 67:
  
 |} |}
 +
 +===== File =====
 +
 +The file operations are limited, because I am paranoid of bad actors.
 +The file to be written to MUST be in the RE directory tree, or if your running CUO it can be in the CUO directory tree. Further, the file suffix has to be one of {data, xml, map, csv}. The file suffixes list could be extended, but the main thing I didn't want someone to do damage to files needed for execution. 
 +
 +
 +{|style="font-size:85%; border:solid 2px; width: 50%;"
 +|style="font-size:150%;  padding: 2px" colspan="2" | **Append a line to a file**
 +|- style="background-color:#f0f0f0;"
 +|**Syntax**
 +|style="width: 90%" | Misc.AppendToFile(string FileName, string LineToAppend)
 +|-
 +|colspan="2" |**Description:**
 +|-
 +|colspan="2" |Appends a single line to a file.
 +|- style="background-color:#f0f0f0;"
 +|**Returns**
 +|bool True - success False - Fail
 +|-
 +|**In Object:**
 +|Misc
 +|- style="background-color:#f0f0f0;"
 +|**Parameters:**
 +|string FileName, string LineToInsert
 +
 +|}
 +
 +{|style="font-size:85%; border:solid 2px; width: 50%;"
 +|style="font-size:150%;  padding: 2px" colspan="2" | **Append a line to a file IF it doesn't already exist**
 +|- style="background-color:#f0f0f0;"
 +|**Syntax**
 +|style="width: 90%" | Misc.AppendNotDupToFile(string FileName, string LineToAppend)
 +|-
 +|colspan="2" |**Description:**
 +|-
 +|colspan="2" | Appends a single line to a file if that line does not already exist in the file.
 +use in your code like:
 +<code>
 +#
 +result = Misc.AppendNotDupToFile("C:/CUO/Data/Client/TreasureMaps.csv", "1111, 2222, map,desc,I forget")
 +#
 +</code>
 +|- style="background-color:#f0f0f0;"
 +|**Returns**
 +|bool
 +|-
 +|**In Object:**
 +|Misc
 +|- style="background-color:#f0f0f0;"
 +|**Parameters:**
 +|string FileName, string LineToInsert
 +
 +
 +|}
 +
 +{|style="font-size:85%; border:solid 2px; width: 50%;"
 +|style="font-size:150%;  padding: 2px" colspan="2" | **Remove a line from a file**
 +|- style="background-color:#f0f0f0;"
 +|**Syntax**
 +|style="width: 90%" | Misc.DeleteFile(string FileName)
 +|-
 +|colspan="2" |**Description:**
 +|-
 +|colspan="2" |Deletes a file
 +|- style="background-color:#f0f0f0;"
 +|**Returns**
 +|bool True - success False - Fail
 +|-
 +|**In Object:**
 +|Misc
 +|- style="background-color:#f0f0f0;"
 +|**Parameters:**
 +|string FileName
 +
 +|}
 +
 +
 +{|style="font-size:85%; border:solid 2px; width: 50%;"
 +|style="font-size:150%;  padding: 2px" colspan="2" | **Remove a line from a file**
 +|- style="background-color:#f0f0f0;"
 +|**Syntax**
 +|style="width: 90%" | Misc.RemoveLineInFile(string FileName, string LineToAppend)
 +|-
 +|colspan="2" |**Description:**
 +|-
 +|colspan="2" |Removes a single line from a file if it exists
 +|- style="background-color:#f0f0f0;"
 +|**Returns**
 +|bool True - success False - Fail
 +|-
 +|**In Object:**
 +|Misc
 +|- style="background-color:#f0f0f0;"
 +|**Parameters:**
 +|string FileName, string LineToInsert
 +
 +|}
 +
 ===== System ===== ===== System =====
  
Line 739: Line 838:
 |**Parameters:** |**Parameters:**
 |scriptfilename |scriptfilename
 +
 +|}
 +
 +===== Maps =====
 +{|style="font-size:85%; border:solid 2px; width: 50%;"
 +|style="font-size:150%;  padding: 2px" colspan="2" | **Co-Ordinates of a Decoded Map**
 +|- style="background-color:#f0f0f0;"
 +|**Syntax**
 +|style="width: 90%" | Misc.GetMapInfo(serial)
 +|-
 +|colspan="2" |**Description:**
 +|-
 +|colspan="2" | Retrieve the co-ordinates of a decoded t-map. Your code would look like:
 +<code>
 +#
 +mapInfo = Misc.GetMapInfo(0x400BFD6C)
 +print("Treasure at ({}, {}), Origin ({}, {}), pin at ({}, {})"
 +    .format(mapInfo.MapOrigin.X+mapInfo.PinPosition.X, mapInfo.MapOrigin.Y+mapInfo.PinPosition.Y,
 +            mapInfo.MapOrigin.X, mapInfo.MapOrigin.Y, mapInfo.PinPosition.X, mapInfo.PinPosition.Y))
 +#
 +</code>
 +
 +|- style="background-color:#f0f0f0;"
 +|**Note:**
 +|The pin position is an offset from the origin, so you have to add them to get absolute location
 +
 +|- style="background-color:#f0f0f0;"
 +|**Returns**
 +|MapInfo{ PinPosition, MapOrigin, MapEnd }
 +|-
 +|**In Object:**
 +|Misc
 +|- style="background-color:#f0f0f0;"
 +|**Parameters:**
 +|serial - Serial of the t-map
  
 |} |}
misc_func.1655653662.txt.gz · Last modified: 2022/09/03 22:41 (external edit)

Exception: Git command failed to perform periodic pull: hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. Warning: Permanently added 'github.com,140.82.112.4' (ECDSA) to the list of known hosts. From github.com:RazorEnhanced/razorenhanced.github.io * branch main -> FETCH_HEAD There are no candidates for merging among the refs that you just fetched. Generally this means that you provided a wildcard refspec which had no matches on the remote end.

Exception: Git command failed to perform periodic pull: hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation. Warning: Permanently added 'github.com,140.82.112.4' (ECDSA) to the list of known hosts. From github.com:RazorEnhanced/razorenhanced.github.io * branch main -> FETCH_HEAD There are no candidates for merging among the refs that you just fetched. Generally this means that you provided a wildcard refspec which had no matches on the remote end.

An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the gitbacked plugin.

More info has been written to the DokuWiki error log.