Hi, I’m not sure what the proper term is for what I’m trying to do. Say I’m writing a script like:
MoveTo(-115734,254791)
MoveTo(-114656,254562)
MoveTo(-114562,254314)
UseItem(78)
UseSkill(345)
What item and what skill the character must use will depend on whether the character is a Human, Dwarf, Orc, etc. The scripting language in question does not support variables. So ultimately I will end up with a bunch of separate script files - elf.txt, orc.txt, etc. However, since each script content is 90% identical a simple bugfix will require making the same change in a bunch of files (what could go wrong, right…). So, hypothetically, I’d like to do something like this in the text editor (pseudocode):
<< ! Code for the text editor -
If Char.Race == Orc
Equip_Weapon = 'UseItem(78)' // Use Spiked Club
Attack_Skill = 'UseSkill(345)' // Howl
If Char.Race == Elf
Equip_Weapon = 'UseItem(261)' // Use Bow
Attack_Skill = 'UseSkill(119)' // Chant
>>
MoveTo(-115734,254791)
MoveTo(-114656,254562)
MoveTo(-114562,254314)
$Equip_Weapon
$Attack_Skill
This way I’d work with a single source and get multiple outputs depending on a variable. So when I save the file to exempli gratia ‘elf.txt’ I’d somehow tell the editor that Char.Race is ‘Elf’ and the editor would make variable substitutions to produce the resulting text. Ta-da. Can I do something like this with Sublime?