Saw Dr. Lupo's chat using the !trails command, basically acting like they were playing oregon trail. Anyone got any idea how I can set that up for my chat?
!Trails command?
5 replies
Hey @Giddy Chipmunk!
It could either be an API, a Pastebin, or a combination of both. A quick Google search didn't give me results to such API, so I'm going to guess it's either a custom made API or a simple Pastebin.
I can't say more given the very few explanation you gave on how it works in his chat.
Here is a question to help us understand better: can the chatters interact with the command, meaning can they do clear actions: logging their names, choosing an occupation, buying what they'll need, choosing at which month to start, etc, or is it just a story to read?
So it seems like it fetches a sentence at random, probably stored on a Pastebin, and then chooses if you fail or succeed, and finally what the loss or the reward is. I could be done really simply if you don't mind not having a system that keep tracks of the amount of items people have, like the number of cattle, as Nightbot can't do that.
I'll write a suggestion of solution tomorrow as it's already late for me.
What you want to do is to fill a Pastebin with piece of sentences that the game could write. Create an account, so you can come back and edit the paste later, and make it so it never expires and unlisted so it doesn't appear publicly.
If you want the loss/reward to be random between multiple items, create another paste for it.
Your paste(s) should look like this:
tried forging the river and or cattle/
sentence#2 or item#2/
sentence#3 or item#3
etc...
Don't forget to end each line with a / (slash), except for the last one where it's not necessary.
Here's the command code:
$(eval sentences=`$(urlfetch json https://pastebin.com/raw/XXXXXXXX)`.split(`/`);items=`$(urlfetch json https://pastebin.com/raw/XXXXXXXX)`.split(`/`); s=sentences[Math.floor(Math.random()*sentences.length)]; i=items[Math.floor(Math.random()*items.length)]; r=Math.floor(Math.random()*100); if(r<95){o=`failed, they lose`;}else{o=`succeeded, they earn`;} `$(user) ${s} ${o} ${Math.floor(Math.random()*4)+1} ${i}.`;)
- Replace
XXXXXXXXby the last 8 URL characters of the respective pastes URL, the first one being the sentences, the second being the items. - The players have 5% of chance to succeed and earn a reward, but if you wish to increase their chance of succeeding look for
if(r<95)and replace95by a lower number, for example90if you want to give them 10% of chance to succeed, the maximum allowed number being99to give only 1% of chance of succeeding.
- The players can lose/earn between 1 and 5 items, but if you wish to change the maximum number look for
Math.floor(Math.random()*4)+1and replace5by the maximum you want. If you don't want the minimum to be1replace the whole thing byMath.floor(Math.random()*(max-min))+minwithminandmaxrespectively being your minimum and maximum value, for example with 3 being the minimum and 10 being the maximum:Math.floor(Math.random()*(10-3))+3orMath.floor(Math.random()*7)+3. - And if you want the item they lose to be always the same thing, for example cattle, then look for
${i}and replace it withcattle.
Hope this will please you!
This command doesn't keep track of the loss and win of each players, but it's a start, if you wish to do so, a custom API may be able to do the job, but you'd likely have to write it yourself.
Didn't find your answer? The community is on Discord.
Ask on Discord