Closed Felixmil closed 2 years ago
I'll try and take a look tomorrow. Can't wait.
I'm not too familiar with javascript, does spacing matter? There's a few places where the comma separated lists of strings have spaces and others that don't. I'd imagine it doesn't matter.
Looks good. I didn't get a chance to really dive into the code, but will try and do so this week. Thanks for the hard work.
It depends. Pretty much only inside quotes for strings, but I wouldn't worry about it yet. I suspect a lot will change over the next couple of weeks.
I'm not too familiar with javascript, does spacing matter? There's a few places where the comma separated lists of strings have spaces and others that don't. I'd imagine it doesn't matter.
It does not matter for it to work, but I recognize it is lack of consistency regarding formatting. As MrFarland said just above, those will inevitably change if reused anyway.
Have fun with it !
Great!
Finally ! I'm finally able to submit this PR for your to test and review the system I designed (outrageously reusing Doug Rau's material.
What are all these files ?
JS scripts
generators_data.js
: this file contains all the data that can be used by generators.dice.js
: written by Doug Rau. I think it parses dice command and return the result as an integer.generator.js
: written by Doug Rau. The main engine for picking random element (or list of element) fromgenerators_data.js
npc-generator.js
: functions that will return value to show in the HTML file outputcharacter-name-generator.js
: a rewrite of the original character name generator but using the system submitted here.HTML file
npc-generator.html
: The file you can open in your browser and try !How does it work ?
gen_data
object.generate_text
andgenerate_list
. They have one common argument: the key to the data you want to access and pick randomly. For examplegenerate_text("Race")
will accessgen_data["Race"]
and select one randomly.generate_list()
has one more argument: the number of element to pick in the list, i.e:generate_list("Race", 2)
will return two random races.gen_data
can reference other elements on itself using some{ }
. For exemple:When
generate_text("Cloth")
is called, it will call the same function twice: once for the Color and another for the Cloth type which are both defined in other parts ofgen_data
. I think Doug Rau's system is very clever: it is possible reuse easily previously added data. (NB: I think the best way to populate gen_data would be to think Object Oriented). I didn't test it but I think these "links" can be used on many levels without performances issues.name-generator.js
's functions in the npc-generator. This is to illustrate that with this system we'll be able to reuse previously written data and generators. For exemple if you designed data and a generators focusings armor or cloth description, you will be able to reuse it in several places like npc descriptions, encounters flavors, room or even loot description !Limitations
gen_data
is not ideal but I think with some help we could turn to a json format cut in several parts depending on which type of data the file should contain.gen_data
infinitely has great potential. However to be effective, growing our collection of data will require a lot of thinking and organisation, otherwise, it may quickly become a mess. But I'm sure this will be no match to your planning and organizational skills !Final words
All these may seem clunky sketchy: this is normal, I never wrote a line of JS before working on this. So this PR is not much but I hope it will spark some ideas and maybe lay the fondations of the future generators for the awesome work you are doing with this project.
Don't hesitate to get in touch with me if you want to discuss it further.
Cheers,
Felix