From cbc62b9ec9dd18adebd55bc304f48c4a2a7d9947 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 26 Oct 2024 14:41:32 +0200 Subject: [PATCH] updated description and skip for campaign log / guide if not campaign box --- objects/CampaignImporterExporter.334ee3.json | 2 +- .../CampaignImporterExporter.ttslua | 44 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/objects/CampaignImporterExporter.334ee3.json b/objects/CampaignImporterExporter.334ee3.json index c49379d5..2e8f41ad 100644 --- a/objects/CampaignImporterExporter.334ee3.json +++ b/objects/CampaignImporterExporter.334ee3.json @@ -31,7 +31,7 @@ "ImageURL": "https://steamusercontent-a.akamaihd.net/ugc/2503508192913854749/B7CFE8596F3ED5BCEBD3CD59DF1CE88991AA923F/", "WidthScale": 0 }, - "Description": "Saves the state of the table to enable loading the campaign into a new save and keep all current progress.\n\nThis tool will track which campaign you're playing, the entire contents of your campaign log, the contents of your chaos bag, update your health/sanity according to trauma, your ArkhamDB deck IDs, the number of investigators, the page of your campaign guide, cards in the Additional Player Cards bag and any options you have selected in the options panel.\n\nFor saving trauma values to correct seats, ensure investigators in the campaign log are in the following order: White, Orange, Green, Red\n\nFor custom campaigns, ensure: 1) Campaign Box, Campaign Log, and Campaign Guide each have the corresponding tag, 2)The Campaign Box is on the table when you import or export.", + "Description": "This tool will allow you to export a lot of mod-internal settings and the state of a campaign.\n\nInstructions:\n1) Make sure the Campaign Box is downloaded and on the table\n2) Press 'Export' to create a coin with the data or place a coin to load its data", "DragSelectable": true, "GMNotes": "", "GUID": "334ee3", diff --git a/src/accessories/CampaignImporterExporter.ttslua b/src/accessories/CampaignImporterExporter.ttslua index 7d596895..d08ba39d 100644 --- a/src/accessories/CampaignImporterExporter.ttslua +++ b/src/accessories/CampaignImporterExporter.ttslua @@ -21,7 +21,7 @@ local saveTokenData = { scaleY = 2, scaleZ = 2 }, - Description = "SCED Importer Token", + Description = "SCED Importer Token\n\nSave me (Right-Click: Save as object)! Then you can import me on any fresh game to apply the saved settings / campaign state.", Tags = { "ImporterToken" }, CustomMesh = { MeshURL = "https://steamusercontent-a.akamaihd.net/ugc/943949966265929204/A38BB5D72419E6298385556D931877C0A1A55C17/", @@ -248,30 +248,32 @@ function exportToToken() -- need to reset the contained objects to support multiple exports saveTokenData.ContainedObjects = {} - -- save campaign log if present - local campaignLog = findUniqueObjectWithTag("CampaignLog") - if campaignLog then - local logData = campaignLog.getData() - logData.Locked = false - table.insert(saveTokenData.ContainedObjects, logData) + if campaignBox then + -- save campaign log if present + local campaignLog = findUniqueObjectWithTag("CampaignLog") + if campaignLog then + local logData = campaignLog.getData() + logData.Locked = false + table.insert(saveTokenData.ContainedObjects, logData) - -- maybe also extract the trauma values - local trauma = campaignLog.getVar("returnTrauma") - if trauma then - printToAll("Trauma values found in campaign log!", "Green") - dataToSave.trauma = {} - for _, val in ipairs(campaignLog.call("returnTrauma")) do - table.insert(dataToSave.trauma, val) + -- maybe also extract the trauma values + local trauma = campaignLog.getVar("returnTrauma") + if trauma then + printToAll("Trauma values found in campaign log!", "Green") + dataToSave.trauma = {} + for _, val in ipairs(campaignLog.call("returnTrauma")) do + table.insert(dataToSave.trauma, val) + end + else + printToAll("Trauma values could not be found in campaign log!", "Yellow") end - else - printToAll("Trauma values could not be found in campaign log!", "Yellow") end - end - -- store campaign guide page if present - local campaignGuide = findUniqueObjectWithTag("CampaignGuide") - if campaignGuide then - dataToSave.guide = campaignGuide.Book.getPage() + -- store campaign guide page if present + local campaignGuide = findUniqueObjectWithTag("CampaignGuide") + if campaignGuide then + dataToSave.guide = campaignGuide.Book.getPage() + end end -- store the additional index if there are any cards in it