It looks like you're new here. If you want to get involved, click one of these buttons!
So I have a generator that I use to randomly roll spell scrolls. There are two prompts in the generator. One for level and one for class.
I am wondering if there is a way that I can access this generator in another generator. I am interested in using the random scroll generator in a treasure generator. So if a 2nd level scroll is found I can pass 2nd level and random class from the treasure generator and get a result from the spell scroll one in the treasure generator script.
This is the script I have for the randoms scroll generator. It works like a charm.
use: Eberron\Spells\ArcaneSpells.ipt
use: Eberron\Spells\ArtificerSpells.ipt
use: Eberron\Spells\BardSpells.ipt
use: Eberron\Spells\ClericSpells.ipt
use: Eberron\Spells\DruidSpells.ipt
use: Eberron\Spells\PaladinSpells.ipt
use: Eberron\Spells\RangerSpells.ipt
use: Eberron\Spells\WarlockSpells.ipt
Header: Random Spell Scroll.
Use the prompt at the bottom left of the window to select a spell level.
MaxReps: 6
Prompt: Choose a Level {Random|1|2|3|4|5|6|7|8|9}1
Prompt: Choose a Class {Random|Arcane|Artificer|Bard|Cleric|Druid|Paladin|Ranger|Warlock}Random
Define: NumSpells = 1
Table: SpellProxy
[@RandomSpell]
Table: RandomSpell
Scroll of [!{$NumSpells} [@CasterClassTable] >> sort >> implode]
Table: CasterClassTable
[@Level][when]{$prompt2}=Random[do][@RandomCasterClassTable][else]Spells{$prompt2}Level{$SpellLevel}[end]
Table: RandomCasterClassTable
[@Level]Spells[when]{$SpellLevel}>5[do][@ClassHigh][else][@ClassMid][end]Level{$SpellLevel}
Table: Level
[when]{$prompt1}=Random[do]{SpellLevel=={1d9}}[else]{SpellLevel=={$prompt1}}[end]
Table: ClassMid
Type: Lookup
Roll: 1d120
01-10:Druid
11-25:Cleric
26-45:Artificer
46-75:Arcane
76-90:Bard
91-100:Warlock
101-110:Paladin
111-120:Ranger
Table: ClassHigh
Type: Lookup
01-10:Druid
11-25:Cleric
26-55:Arcane
56-70:Bard
71-80:Warlock
Table: ClassCantrip
Type: Lookup
01-10:Druid
11-25:Cleric
26-45:Artificer
46-75:Arcane
76-90:Bard
91-100:Warlock
Comments
I'm guessing that would be an unsupported feature. I read in the help file "Prompt commands are ignored by the command line and CGI versions of the program". Even if it does work, you must prompt for those inputs in your main generator that uses this generator, AND risk that the prompts get out of sequence in the calls.
So to try to make it work, modify this generator to something like:
Define: PromptLevel={$Prompt1}
Define: PromptClass={$Prompt2}
Then, replace all your {$Prompt1} and {$Prompt2} calls in the generator with the variables PromptLevel and PromptClass
In your new generator (that the user will directly call) prompt for and Define PromptLevel and PromptClass there, too.
So the new generator will prompt for the input that the embedded external generator needs and pass those through as defined variables (really, Constants at this point). The external generator is rewritten to use those variables in the tables rather than using $Prompt1 and $Prompt2.
This probably works around the order of the prompts getting jumbled when passing them through to the external generator.
Here's a revised version of your earlier smaller generator so you can see how the Define and variable calls work. Note the {$var} syntax used in the When statements and the var syntax used in {SpellLevel==PromptLevel}
I haven't tested any of this yet with an external generator, so good luck! Hope it works.
Thanks for this. This does work, only issue is the prompts for this generator do appear in the new generator for treasure that I was making. That is a little annoying, but not a big deal.
Can you explain a little bit what you did to the code here and how you intend it to work. Not quite understanding the general changes to the code that you made and how that is doing the same thing that I had going on.
So, the Prompt: call at the start asks for user input and automatically creates a variable called $Prompt1 and defines its value as the user entered value. The problem comes in that the external generator you call might be using the variable $Prompt1 for something entirely different, thus pushing bad (unexpected value) to the external generator.
What I almost always do with prompts is immediately use a Define: call to create a distinct variable (constant, really) that is equal to user input value, then use that defined variable in all my tables and calculations. After the Define: command, you never again have to worry about whether that input was $Prompt1 or $Prompt2 or whatever. It's always a variable that you named to mean something intuitive.
For your purposes, the real value is: you're passing a distinct variable with a defined value from the generator that your user directly interfaces with to the external generator that your user never directly sees. There is no question that when you pass a variable named $SpecialVariable to the external generator, that the external generator applies that value every time it sees {$SpecialVariable} or SpecialVariable.
Now then, why is the syntax {$SpecialVariable} in the When condition and just SpecialVariable in the == statement? Hell if I know. Just one of those things where I try every syntax till one works. I'm sure it's all there in the help file, but I just can't figure it out.
Hope I answered what you were asking. Good luck!
Oh I understood the prompt part. I was talking about how you seemed to rewrite the spell selection part. I don't quite understand all the math that you are doing in the rewrite there and why.
All this part.
Oh... I just thought your generator was cool and started to tweak it for myself. Was thinking a scroll of a particular user magic level might have spells of his max usable level or lower, with more number of spells if a lower power spell, and fewer if a higher power spell. Anyway, i was just messing around and never did tweak it to exactly what I was thinking I wanted.
Would be great if you uploaded your final generators to forum or downloads area. I think you're on to a really cool set of tools.
Thanks. I always get annoyed when a spell scroll comes up for random loot, and there is no easy way to roll for what the spell or class is, so I love this generator.
I also have another one to generate a random spell book with 5E spells.