Skip to content

Instantly share code, notes, and snippets.

View palikhov's full-sized avatar
🐉
E5E / SRD 5.1 rus / Excel GM Tools

Anton Palikhov palikhov

🐉
E5E / SRD 5.1 rus / Excel GM Tools
View GitHub Profile
Option Explicit
Public Sub BulkNPCGen()
Dim NPCs, i, j As Integer
Dim Dum As String
Dim WrkN As String
Dim NPCLim As Integer
Dim Race, PresetRace, Gender As String
Option Explicit
Public Sub ClearNPC()
Dim Conf As String
'Conf = MsgBox("Are you sure you want to clear the NPC Generator form?", vbOKCancel, "Are you sure?")
'If Conf = vbOK Then
Sheets("NPC Generator").Range("NPCName").Value = ""
Sheets("NPC Generator").Range("NPCRace").Value = ""
Sheets("NPC Generator").Range("NPCGender").Value = ""
Option Explicit
Private Function Menu(Quality, EType)
Dim M, FoodPriceS, DrinkPriceS As String
Dim FCount, DCount, DP, FP As Integer
Dim Dum As String
Dim SplitIt() As String
Dim i, j As Long
Option Explicit
Public Sub TESTCALL()
Call GenerateNPC
End Sub
Public Sub GenerateNPC(Optional PresetName = "", Optional PresetRace = "", Optional PresetGender = "", Optional PresetNameRegion = "", Optional OutAppearance = "", Optional OutPersonality = "", Optional OutName = "", Optional NPCTitle = "NPC", Optional SkipConfirmation = False, Optional OutNPC)
Dim i As Integer
Dim N, ShortN As String
Dim Conf As String
Option Explicit
Public Sub QuickSort(vArray As Variant, inLow As Long, inHi As Long)
Dim pivot As Variant
Dim tmpSwap As Variant
Dim tmpLow As Long
Dim tmpHi As Long
tmpLow = inLow
tmpHi = inHi
@palikhov
palikhov / DiceXlator.vb
Created February 8, 2022 08:50
primitive macro to dice formula excel
Sub DiceXlator()
Dim r As Range, v As String, NewForm As String, deemode As Boolean
Dim dee As String
dee = "d"
deemode = False
For Each r In Selection
v = r.Value
NewForm = "="
For i = 1 To Len(v)
ch = Mid(v, i, 1)
@palikhov
palikhov / RollDice.vb
Created February 8, 2022 08:48
UDF Roll Dice Formula
Public Function RollDice(r As Range) As Variant
Application.Volatile
Dim v As String, NewForm As String, deemode As Boolean
Dim dee As String
dee = "d"
deemode = False
v = r.Value
NewForm = "="
For i = 1 To Len(v)
ch = Mid(v, i, 1)
@palikhov
palikhov / RandomValueFromCell.vb
Created February 8, 2022 08:28
Return random value from list stored in one cell in Excel
Function RandomValueFromCell(r As Range, separator As String)
Dim cell As Range
Dim i As Integer
Dim x As Double
Dim ArraySize As Integer
List = Split(r, separator)
ArraySize = UBound(List) + 1
@palikhov
palikhov / token-hooded-lantern.js
Created January 30, 2022 17:43
Foundry VTT Token Hooded Lantern Macro
const dialogContent = `
<style>
#hooded-lantern-dialog .dialog-buttons {
flex-direction: column;
background: #FFFACD;
}
</style>
<h2>Light the Hooded Lantern</h2>
<p>Choose from the following options:</p>
`;
@palikhov
palikhov / token-torch.js
Created January 30, 2022 17:43
Foundry VTT Token Light Torch Macro
if (token.data.light.dim === 0) {
await token.document.update({
light: {
alpha: 0.4,
angle: 0,
bright: 20,
coloration: 1,
dim: 40,
gradual: true,
luminosity: 0.5,