Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[HELP]Rumor Mill with query for topic

Hi! I am new to Roll and GMing and APIs have saved my life. I have implemented the Rumor Mill script created by Nick Olivo (<a href="https://gist.github.com/nolivo/e08d56558cdcbe95a90c39cf853b5642" rel="nofollow">https://gist.github.com/nolivo/e08d56558cdcbe95a90c39cf853b5642</a>), but I would like to query for a topic to get a rumor on. As I am also new to coding I am seeking help to update the script to include the query and don't know where to begin. I appreciate any help I can get. Thanks!
1727194156
timmaugh
Pro
API Scripter
Hey, Glen... from a quick read through, it looks like that script is already built to allow for a topic to be supplied, so I wouldn't think you have to alter the script itself; just your command line. It looks like the script is expecting a command line like: !gatherRumors --@{target|PIck Rumor Source|token_id} &nbsp; --@{selected|token_id} &nbsp;--?{Subject query here} The first argument is the NPC source of the rumor. The second argument is the PC who is hearing the rumor. And the third argument seems to be a topic/subject. So if you want to limit it to certain topics (like "SaintlyCarp", "ButrickTrundle", and "EnglebertSlaptiback"), you could just enter those in the query: ?{Rumor Subject|SaintlyCarp|ButrckTrundle} Is that what you're looking for, or have I misunderstood the purpose of that third argument?
The command line is as follows:&nbsp; !gatherRumors --@{selected|character_id} --@{target|Who Do You Want To Talk to?|token_id} --?{Check Type|Persuasion|Deception|Intimidation}
1727204247
timmaugh
Pro
API Scripter
OK... so at line 171 of the script, we're at a point where all of the "possible" rumors have been collected from the NPC, and it looks like we're going to filter them for those that apply (the function name is "get ApplicableRumors()"). That section: _.each(rumorList, function (rumor) { if (rumor.toLowerCase().includes(`|${checkType}|`) || rumor.toLowerCase().includes("|any|")) { appRumorList.push(rumor); } }) So, it looks like for the rumor to be included in our new list of applicable rumors, it has to have the "type" included between pipes. Have you done that with your rumors? Or are you trying to do something beyond what this section describes?
I was trying to do something beyond that, but I think I'm going to put a pin in it for now and focus on&nbsp; learning java and then go from there.
1727208469
timmaugh
Pro
API Scripter
Fair enough. But, if you are wanting to learn scripting for Roll20, you'll want to learn JavaScript (not Java). When you're ready to try your hand at a Roll20 script, here are some resources that might be of help.