• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

CodeGen 1.0.2

Introduction

Sometimes you need to transfer data between games in order to keep the progress you've made. For example in RPG maps you probably want to save your hero, levels, gold and items so you can continue next time you play. The way this is done in Warcraft III by generating codes that contain all of your data, which can later be re-entered to restore that saved information. This is nothing new in the modding world however it's commonly asked about and requested yet many people still have issues. This is part of the reason why I decided to create an easy to use, universal, GUI-friendly save and load system which I'm calling the Code Generator.

Main Features
  1. Player-name sensitive (optional).
  2. Highly configurable.
  3. Can be used in the normal World Editor (doesn't require JNGP).
  4. Very easy to use.


  • -------- -------------------- --------
  • -------- The below options are for saving load codes to the Warcraft III folder. --------
  • -------- You can modify the file name via the SaveLoad_Filename variable within the save trigger. --------
    • -------- -------------------- --------
    • Set SaveLoad_SaveToDisk = True
    • Set SaveLoad_Directory = Save
    • -------- -------------------- --------
    • -------- Some configurables --------
    • -------- -------------------- --------
    • Set SaveLoad_Alphabet = abcdefghkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789
    • Set SaveLoad_CheckName = True
    • Set SaveLoad_Security = True
    • Set SaveLoad_HyphenSpace = 4
    • Set SaveLoad_SeperationChar = -
    • Set SaveLoad_Lower = |c002a4580
    • Set SaveLoad_Number = |cffffcc00
    • Set SaveLoad_Upper = |cff008000
    • -------- -------------------- --------
    • -------- Increase the value if you want to save bigger numbers --------
    • -------- Decrease it if you want to generate a smaller save code but only be able to save smaller values --------
    • -------- It's suggested to not increase it above 7 --------
    • -------- -------------------- --------
    • Set SaveLoad_MaxValue = 6
    • -------- -------------------- --------
    • -------- Store all the heroes you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Hero[0] = Blood Mage
    • Set SaveLoad_Hero[1] = Lich
    • Set SaveLoad_Hero[2] = Blademaster
    • Set SaveLoad_Hero[3] = Demon Hunter
    • Set SaveLoad_HeroCount = 3
    • -------- -------------------- --------
    • -------- Store all the abilities you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Abilities[0] = Flame Strike
    • Set SaveLoad_Abilities[1] = Siphon Mana
    • Set SaveLoad_Abilities[2] = Phoenix
    • Set SaveLoad_Abilities[3] = Banish
    • Set SaveLoad_AbilityCount = 3
    • -------- -------------------- --------
    • -------- Store all the items you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Item[0] = (Item-type of No item)
    • Set SaveLoad_Item[1] = Claws of Attack +15
    • Set SaveLoad_Item[2] = Crown of Kings +5
    • Set SaveLoad_Item[3] = Kelen's Dagger of Escape
    • Set SaveLoad_Item[4] = Mask of Death
    • Set SaveLoad_Item[5] = Orb of Frost
    • Set SaveLoad_Item[6] = Ring of Protection +5
    • Set SaveLoad_ItemCount = 6
    • -------- -------------------- --------
    • -------- Don't modify below this line. --------
    • -------- This is just here to copy variables to your map --------
    • -------- -------------------- --------
    • Set SaveLoad_Full = SaveLoad_Alphabet
    • Set SaveLoad_Error = <Empty String>
    • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
    • Set SaveLoad_Char[0] = <Empty String>
    • Set Load[0] = 0
    • Set LoadCount = 0
    • Custom script: call CodeGen_Init()
Installation
  1. Make sure your settings allow copying variables (Image)
  2. Copy the CodeGen folder over to your map.
  3. Paste the maps script into yours (Image)

How do I use it?

Let's take a look at the most basic example.

  • Set Save[0] = (Player 1 (Red) Current gold)
  • Custom script: set udg_Code = CodeGen_Compile()
  • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code

The above will save Players 1's gold. Simple, isn't it? Now you're probably asking "How do I load it?".

  • -------- Check if load is valid --------
  • Set Code = (Substring((Entered chat string), 7, 999))
  • Custom script: call CodeGen_Load(udg_Code)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SaveLoad_Valid Equal to False
    • Then - Actions
      • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: SaveLoad_Error
      • Skip remaining actions
    • Else - Actions
  • Player - Set Player 1 (Red) Current gold to Load[0]

Equally as simple and there are more examples are available in the demo map.

Keywords:
save,load,save load,save and load,code,codegen,code gen,triggerhappy,password,gen,generator,generate,preloadgen,preload,file,io,to,disk
Contents

CodeGen v1.0.2 (Map)

Reviews
8 March 2014 PurgeandFire: Approved. Review: http://www.hiveworkshop.com/forums/2496968-post145.html 21 December 2013 Bribe: changed status to needs fix. 8 Sep 2011 Bribe: Deprecated in favor of: Save/Load with Snippets 21:27, 29th Aug...

EdgeOfChaos

E

EdgeOfChaos

This is my setup (it's long)
  • CodeGen Init
    • Events
      • Time - Elapsed game time is 0.03 seconds
    • Conditions
    • Actions
      • -------- -------------------- --------
      • -------- Some configurables --------
      • -------- -------------------- --------
      • Set SaveLoad_Alphabet = abcdefghkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789
      • Set SaveLoad_CheckName = True
      • Set SaveLoad_Security = True
      • Set SaveLoad_HyphenSpace = 4
      • Set SaveLoad_SeperationChar = -
      • Set SaveLoad_Lower = |c002a4580
      • Set SaveLoad_Number = |cffffcc00
      • Set SaveLoad_Upper = |cff008000
      • -------- -------------------- --------
      • -------- Increase the value if you want to save bigger numbers --------
      • -------- Decrease it if you want to generate a smaller save code but only be able to save smaller values --------
      • -------- It's suggested to not increase it above 7 --------
      • -------- -------------------- --------
      • Set SaveLoad_MaxValue = 20
      • -------- -------------------- --------
      • -------- Store all the items you want to be able to be saved below. --------
      • -------- -------------------- --------
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level One|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Two|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Three|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Four|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Five|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Six|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Seven|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Level Eight|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic|r Weapon - |cffff0000Complete|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Bronze
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff008000Enchantment Stone - Level One|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Bronze
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Iron
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Steel
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff0000Enchantment Stone - Level Two|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Iron
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Steel
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Silver
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Silver
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level One|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Two|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Three|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Four|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Five|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Six|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Seven|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Level Eight|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffd600Enhanced|r Weapon - |cffff0000Complete|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Complete|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Eight|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Five|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Four|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level One|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Seven|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Six|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Three|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Elemental|r Weapon - |cffff0000Level Two|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffCrystalized Skull|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r |cff0080ffCrystalized Skull|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffIce Shard|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r |cff00ffffIce Shard|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Gold
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Gold
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Platinum
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Platinum
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Silver
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r Silver
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffEnchantment Stone - Level Three|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffd400f9Enchantment Stone - Level Four|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff804040Contaminated Metal|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r|cff804040 Contaminated Metal|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff80ffEnchantment Stone - Level Five|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff0000Blood-stained axe|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = (Item-type of No item)
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffSoul Iron|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r|cff804040 |r|cff0080ffSoul Iron|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffSatyr Scythe|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffBasic Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffSatyr Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffffff00Jungle Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0000ffFrozen Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff464646Dark Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff0000S|r|cffffff00o|r|cff80ff00u|r|cff00ff40l|r|cffd400f9 |r|cff00ffffA|r|cff0080c0r|r|cff8080c0m|r|cffff00ffo|r|cff464646r|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Level Book
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff800080Quagmire Venom|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r|cff804040 |r|cff800080Quagmire Venom|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff8080ffEnchantment Stone - Level Six|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ff40Natural Soul|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted|r|cff804040 |r|cff00ff40Natural Soul|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ff40Voodoo Scythe|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff800040Poisoned Scythe|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ff40Natural Soul Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff800040Poisoned|r|cff00ff40 |r|cff800040Soul Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffTwisted Flames|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffEnflamed Scythe|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff0080ffWavering |r|cffff0000Fire|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cff0080ffWavering |r|cffff0000Fire|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = SP Package
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff008080Enchantment Stone - Level Seven|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff804040Thantos Soul|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cff804040Thantos Soul|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff464646Pale Essense|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cff464646Pale Essense|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff464646Cold Armor|r |cff0080ff- Level 1|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff464646Cold Armor|r |cff0080ff- Level 2|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff464646Scythe of Death|r|cff0080ff - Level 1|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff464646Scythe of Death|r|cff0080ff - Level 2|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff0000Grand Fire|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cffff0000Grand Fire|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff8e0000Incinerator|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffScale Armor|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffScaled Staff|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffFreezing Mail|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffEmpowered Icy Staff|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff259e9eEternity Blade|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff259e9eEternal Shroud|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff00ffffPermafrost Scale|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cff00ffffPermafrost Scale|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff80ffffCondensed Element|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cff80ffffCondensed Element|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff259e9eThe Glass of Eternity|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cffff8040Enchanted |r|cff259e9eGlass of Eternity|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = |cff8e0000Doom Fire|r
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • Set SaveLoad_Item[SaveLoad_ItemCount] = Magical Blasting Tome
      • Set SaveLoad_ItemCount = (SaveLoad_ItemCount + 1)
      • -------- -------------------- --------
      • -------- Store all the heroes you want to be able to be saved below. --------
      • -------- -------------------- --------
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = GoblinClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = ArcherClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = BloodmageClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = HolyKnightClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = SamuraiClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = SlayerClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = WLClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = ConjurerClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = TaurenClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = SorrowClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = NSClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = STClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set SaveLoad_Hero[SaveLoad_HeroCount] = SkyClasses[(Integer A)]
          • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • Set SaveLoad_Hero[SaveLoad_HeroCount] = |cffc23297Developer|r
      • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • Set SaveLoad_Hero[SaveLoad_HeroCount] = |cff0000ffDonator|r Doom1821
      • Set SaveLoad_HeroCount = (SaveLoad_HeroCount + 1)
      • -------- Don't modify below this line. --------
      • -------- This is just here to copy variables to your map --------
      • -------- -------------------- --------
      • Set SaveLoad_Full = SaveLoad_Alphabet
      • Set SaveLoad_Error = <Empty String>
      • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
      • Set SaveLoad_Char[0] = <Empty String>
      • Set Load[0] = 0
      • Set LoadCount = 0
      • Custom script: call CodeGen_Init()
No relation I can see with names.
1: greenlemonade
2: SS4Gotenkzz
3: sayonara
4: There was "angelofsomething" or some similar, but I forget his name.
 
Level 18
Joined
Nov 21, 2012
Messages
835
NOT always working..

Hi, I made simple test to see how it works, sometimes system prints: 'Invalid Code'. Just want to save 2 integers per player, not more. Here test triggers:
When I set Save[0] in 'Basic Save' trigger to 55 or less it not works, if i set bigger value it works..please fix.



  • CodeGen Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------- --------
      • -------- Some configurables --------
      • -------- -------------------- --------
      • Set SaveLoad_Alphabet = abcdefghkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789
      • Set SaveLoad_CheckName = True
      • -------- ---- system NIE przyjmuje kodu (czy to dobry czy zly) jesli jest ustawion na False---------------- --------
      • Set SaveLoad_Security = True
      • Set SaveLoad_HyphenSpace = 4
      • Set SaveLoad_SeperationChar = -
      • Set SaveLoad_Lower = |c002a4580
      • Set SaveLoad_Number = |cffffcc00
      • Set SaveLoad_Upper = |cff008000
      • -------- -------------------- --------
      • -------- Increase the value if you want to save bigger numbers --------
      • -------- Decrease it if you want to generate a smaller save code but only be able to save smaller values --------
      • -------- It's suggested to not increase it above 7 --------
      • -------- -------------------- --------
      • Set SaveLoad_MaxValue = 6
      • -------- -------------------- --------
      • -------- Store all the items you want to be able to be saved below. --------
      • -------- -------------------- --------
      • Set SaveLoad_Item[0] = (Item-type of No item)
      • Set SaveLoad_Item[1] = Claws of Attack +15
      • Set SaveLoad_Item[2] = Crown of Kings +5
      • Set SaveLoad_Item[3] = Kelen's Dagger of Escape
      • Set SaveLoad_Item[4] = Mask of Death
      • Set SaveLoad_Item[5] = Orb of Frost
      • Set SaveLoad_Item[6] = Ring of Protection +5
      • Set SaveLoad_ItemCount = 0
      • -------- -------------------- --------
      • -------- Store all the heroes you want to be able to be saved below. --------
      • -------- -------------------- --------
      • Set SaveLoad_Hero[0] = No unit-type
      • Set SaveLoad_Hero[1] = Lich
      • Set SaveLoad_HeroCount = 0
      • -------- -------------------- --------
      • -------- Don't modify below this line. --------
      • -------- This is just here to copy variables to your map --------
      • -------- -------------------- --------
      • Set SaveLoad_Full = SaveLoad_Alphabet
      • Set SaveLoad_Error = <Empty String>
      • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
      • Set SaveLoad_Char[0] = <Empty String>
      • Set Load[0] = 0
      • Set LoadCount = 0
      • Custom script: call CodeGen_Init()



  • Basic Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as A substring
    • Conditions
    • Actions
      • -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Substring((Entered chat string), 6, 8)))) Greater than 0
          • (Integer((Substring((Entered chat string), 6, 8)))) Less than 1000
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: (You entered: + (Substring((Entered chat string), 6, 8)))
          • Set Save[0] = 20
          • Set Save[1] = (Integer((Substring((Entered chat string), 6, 8))))
          • Set SaveCount = 1
          • -------- Show Code --------
          • Custom script: set udg_Code = CodeGen_Compile()
          • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code
        • Else - Actions
          • Game - Display to (All players) the text: Enter integer!



  • Basic Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 6)) Equal to -load
    • Actions
      • -------- Check if load is valid --------
      • Set Code = (Substring((Entered chat string), 7, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Valid Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
          • Skip remaining actions
        • Else - Actions
      • Game - Display to (All players) the text: (Loaded Value #1: + (String(Load[0])))
      • Game - Display to (All players) the text: (Loaded Value #2: + (String(Load[1])))
      • Game - Display to (All players) the text: (Loaded Value #3: + (String(Load[2])))


regards Zibi
 
Level 18
Joined
Nov 21, 2012
Messages
835
  • Set SaveLoad_MaxValue = 6
I think SaveLoad_MaxValue was a problem, I set to 3 or 4 (to shortren code) and that cause system to fall apart-not only limitation (as you said lower number can be saved) but also Save[x] is not Load[x] but Load[x+1] for example. But Set SaveLoad_HeroCount = 1, and Set SaveLoad_ItemCount = 6 these are meaningless. THx anyway Mr lol.
 
Level 8
Joined
Jul 17, 2004
Messages
283
Good system, thanks!

Is there ever a possibility with anything not carrying over when releasing a new version and loading a hero from a previous version?
 
Hello TriggerHappy,
I used your save/load system in my map, Return of Legends. It works fine for most users, but some users are having problems. No code they obtain from the system will work.

I've tried spoofing on LAN as the user and entering their code (copied myself from a screenshot) and everything. Nothing seems to work for a few users. Most get the "Wrong username" message but one has recently got the "Ivalid Code" message.

Do you have any idea what is going on? Is there some fix I can apply to the code?

The codes in question are all legitimate copied from the code output.


More info: http://clanrc.enjin.com/forum/page/11/m/20718693/viewthread/11165843-bug-reports
Last post on that page.
Thanks.

Did anyone ever find the fix for this? I am having the same problem except not a single person can even load, invalid username for everyone. No relation in name at all either.

Edit:I fixed it a little, it seems you can't really configure the system. If you don't save/load the items, gold then it won't work. Does it still bug if you have more then 100 items?


Mostly all user bugs, my bad... However could you explain a bit about the max value part/Set SaveLoad_MaxValue = 7. Like how do we as users know when to raise/lower it when we have no idea how long it has to be to need to be increased. Like what does it affect and what is the equation. It seems like a useless value that everyone would instantly raise to 7 or higher or 0 for lowest code sizes.
 
Last edited:
Level 1
Joined
Jan 23, 2017
Messages
2
hello, I seem to have the same problem that Raging Ent had. I cannot get the system to load the value of an integer. Any help?
Check the "CodeGen Save" and "CodeGen Load" triggers, right below where the items are saved/loaded.
 

Attachments

  • CodeGenyy.w3x
    33.1 KB · Views: 74
Level 1
Joined
Jan 23, 2017
Messages
2
I still can't get it to work, no matter what I try. Is it possible to save extra integer values?
No other post conclusively addresses this issue in this thread, so a quick comment or a redirection or something would be appreciated.
 
Level 7
Joined
Mar 10, 2013
Messages
366
Is there a possible way to create a scrambler so I can wipe the code from a map version to another?

Would scrambling the alphabet does that?
 
Level 3
Joined
Jun 22, 2016
Messages
31
So i have a problem that does not make any sense to me: in "line 244" of CodeGen Load, there is a "Symbol not Declared" (CodeGen_Load) error the same happens on CodeGen Save with line 231(CodeGen_ConvertUnit) 251 (CodeGen_ConvertItem) and 262 (CodeGen_Compile), plus in CodeGen Init line 359 once again like the others there is a symbol not declared error with (CodeGen_Init)

If you could provide a way to fix this that'd be great since wc3's recent updates fucked every single save/load triggers I've tried using. I doubt anyone will answer since the last reply was a reply for help in 2017 may 27 and it was never answered but i hope i get answered.
 
So i have a problem that does not make any sense to me: in "line 244" of CodeGen Load, there is a "Symbol not Declared" (CodeGen_Load) error the same happens on CodeGen Save with line 231(CodeGen_ConvertUnit) 251 (CodeGen_ConvertItem) and 262 (CodeGen_Compile), plus in CodeGen Init line 359 once again like the others there is a symbol not declared error with (CodeGen_Init)

If you could provide a way to fix this that'd be great since wc3's recent updates fucked every single save/load triggers I've tried using. I doubt anyone will answer since the last reply was a reply for help in 2017 may 27 and it was never answered but i hope i get answered.

You need to copy CodeGen's script header over to your map.

http://www.hiveworkshop.com/forums/pastebin_data/8ro5fg/codegen2.jpg
 
Level 3
Joined
Jun 22, 2016
Messages
31
Thank you so much for replying and especially so fast i didn't even think i'd get answered, and if this works that'll be amazing because wc3's updates fucked every other system up for me so i'm glad that the fix for this is so simple.
 
Last edited:
Level 3
Joined
Jun 22, 2016
Messages
31
Hey whenever i load a hero only the top left item gets saved does it have something to do with the default item saving integer a being 1 to 7 because i'm sure it should be 1 to 6
 
Level 3
Joined
Jun 22, 2016
Messages
31
Ok since you have not answered me and i want to fix this can someone look at my map and tell me why only the top left item gets saved/loaded in a hero's inventory.
 

Attachments

  • Land Of Hope Rpg.w3x
    1.3 MB · Views: 74
Level 12
Joined
Mar 24, 2011
Messages
1,082
Ok since you have not answered me and i want to fix this can someone look at my map and tell me why only the top left item gets saved/loaded in a hero's inventory.
You should post in WEHZ or Triggers & Scripts for your own problems, not in people's resources.
One of the reasons is because those two sections get a LOT MORE exposure and traffic than here.

regards
-Ned
 
Level 2
Joined
Sep 24, 2016
Messages
15
To add to the betterment of this system, I have info to share.

1.
If you save while having items in your inventory that are not included in the list of items that will be saved, your code may bug.
I.e. if you save while carrying an item in inventory slot 1 that “does not save”, and load your Hero in another game, it may have a row of different items.

2.
If you save while the items in your inventory are not placed correctly, your code may bug.
I.e. if you save while the first inventory slot is empty, and the other slots are not, and then load your Hero in another game, it may have a row of different items.


To avoid these issues you can
- make every single item that your Hero can obtain in your map saveable.
- make the game drop all items worn by the Hero and give them back to the Hero (all before actually executing the save) to ensure that items are arranged correctly.

- if you have unsaveable items in your map that Heroes can wear while saving, you can make the game drop all the Hero’s items, only give back saveable ones,
execute the saving, and then give back the unsaveable items. Though this requires you to classify i.e. unsaveable items so the game knows which items to give back
before and after executing the save.


I hope these points will be added somehow (e.g. as comments) to make users aware of why they may encounter these issues.
Thanks for generously developing and sharing this system.
 
Level 3
Joined
Mar 1, 2018
Messages
41
I'm sorry to disrupt maybe I'm just too much of a noob.

From all the save/load code systems I've tried, this was the only one I was able to save the map and get back and test without getting a fatal error.

I've managed to add STR AGI and INT saving after a few tries and also made it save items in a region and it worked.

I was interested in knowing how to save unit abilities of my heroes, their levels, and possibly spellbooks (with their respective ability levels)

(I've got some triggers that add unit abilities and set their levels permanently)

Also knowing how to save tech upgrades and their levels.

Anyway I've started re-learning about the editor 6 weeks ago and your system is amazing specially for someone so casual like me, I barely know to use a computer. xD +Rep
 
Last edited:
Level 13
Joined
Mar 24, 2010
Messages
950
Hey TriggerHappy,
I know you have a better system out than this now so your heart probably isn't in this one's as much but I was wondering a few things about this.
1. what does this do? there is no notes on it with exact numbers etc. Set SaveLoad_MaxValue = 6
Does the 6 stand for bits as in 64bit? but it seems the string of characters is only 58 characters long? Is that why it shouldn't go over 7 for 128bit? But wouldn't it need 128 characters?

2. Would adding characters to that string make this code be able to store more bits per character like the very old NPS system (Neostorm's) so say instead of 58 or 64 characters if i made it 90 or 128 characters would that make code store more in a shorter string? (not that it matters a ton since it is stored to text, just wondering)
 
Last edited:
Hey TriggerHappy,
I know you have a better system out than this now so your heart probably isn't in this one's as much but I was wondering a few things about this.
1. what does this do? there is no notes on it with exact numbers etc. Set SaveLoad_MaxValue = 6
Does the 6 stand for bits as in 64bit? but it seems the string of characters is only 58 characters long? Is that why it shouldn't go over 7 for 128bit? But wouldn't it need 128 characters?

2. Would adding characters to that string make this code be able to store more bits per character like the very old NPS system (Neostorm's) so say instead of 58 or 64 characters if i made it 90 or 128 characters would that make code store more in a shorter string? (not that it matters a ton since it is stored to text, just wondering)

1. From what I remember it uses the first N characters from the alphabet to denote how long the upcoming chunk is in the save code. It's a pretty archaic way of doings things, but I did write this 10 years ago.

2. Adding more characters to the alphabet should reduce code size, yes.
 
Level 13
Joined
Mar 24, 2010
Messages
950
1. From what I remember it uses the first N characters from the alphabet to denote how long the upcoming chunk is in the save code. It's a pretty archaic way of doings things, but I did write this 10 years ago.
So if its set to 6, then first 6 characters in the code string denote the upcoming "chunk"? Need a little more info on this.
This is your notes for it in demo map:
- Increase the value if you want to save bigger numbers
- Decrease it if you want to generate a smaller save code but only be able to save smaller values
- It's suggested to not increase it above 7

So based on those notes that tells us almost nothing. lol :)
I need to know why its suggested not to increase above 7, i need to know what adjusting that number does/affects. Can we still save bigger numbers if its just set to 6 still?
In order to know what the best value to set that too it would be nice to know examples or max values or code length examples based on int values sizes its saving.

Is your new codeless system that much more efficient?
 
Level 4
Joined
Mar 9, 2012
Messages
4
I thought it would be worth mentioning that the Encode function does not work properly when the given integer is the exact same value as Base

JASS:
function CodeGen_Encode takes integer i returns string
    if i <= udg_SaveLoad_Base then
        return SubString(udg_SaveLoad_Alphabet, i, i + 1)
    endif

I used the test map to try and save the value 52 (the string length of the charset) and loaded 0 because the indices of the SubString are out of bounds

Cheers 👍
 
Top