Skip to content

Instantly share code, notes, and snippets.

@its-jackson
Created April 11, 2023 00:45
Show Gist options
  • Save its-jackson/5994aad8489ae3b15adbb12b9812cd08 to your computer and use it in GitHub Desktop.
Save its-jackson/5994aad8489ae3b15adbb12b9812cd08 to your computer and use it in GitHub Desktop.
package scripts.kotlin.api
import org.tribot.script.sdk.Waiting
import org.tribot.script.sdk.input.Keyboard
interface RandomMessageProvider {
fun getRandomMessage(): String
}
private val randomMessagePlayerProfile = PlayerBehaviorProfile(
variable1Parameters = DistributionParameters(mean = 50.0, standardDeviation = 10.0),
variable2Parameters = DistributionParameters(mean = 100.0, standardDeviation = 20.0)
)
private val debateStarterHandler = RandomSentenceHandler(
Response.START_DEBATE,
randomMessagePlayerProfile,
getVariableBasedTriggerCondition()
)
private val foundPlayerHandler = RandomSentenceHandler(
Response.FOUND_PLAYER,
randomMessagePlayerProfile,
::isAnyPlayerNearby
)
private val foundPlayerWhileWaitingHandler = RandomSentenceHandler(
Response.WAITING_AND_FOUND_PLAYER,
randomMessagePlayerProfile,
::isAnyPlayerNearby
)
private val actionHandlers = listOf(
getRandomSentenceHandlerAction(debateStarterHandler),
getRandomSentenceHandlerAction(foundPlayerHandler),
getRandomSentenceHandlerAction(foundPlayerWhileWaitingHandler)
)
val scheduler = ActionScheduler(10000L, actionHandlers)
private fun getRandomSentenceHandlerAction(randomSentenceHandler: RandomSentenceHandler): () -> Unit {
return {
if (randomSentenceHandler.shouldTypeRandomSentence()) {
randomSentenceHandler.typeAndEnterRandomSentence()
}
}
}
class RandomSentenceHandler(
private val messageProvider: RandomMessageProvider,
private val player: PlayerBehaviorProfile,
private val triggerCondition: (PlayerBehaviorProfile) -> Boolean
) {
fun shouldTypeRandomSentence() = triggerCondition(player)
fun typeAndEnterRandomSentence() {
val sentence = messageProvider.getRandomMessage()
Keyboard.typeString(sentence)
Waiting.waitNormal(500, 150)
Keyboard.pressEnter()
}
}
enum class Response(private val responses: Array<String>) : RandomMessageProvider {
START_DEBATE(
arrayOf(
"Do you think pineapple belongs on pizza?",
"Which is better: cats or dogs?",
"Is it pronounced 'gif' or 'jif'?",
"Should we still teach cursive writing in schools?",
"Do you think aliens exist?",
"Is a hotdog a sandwich?",
"What's your opinion on climate change?",
"Which is better: Apple or Android?",
"Should we be worried about artificial intelligence?",
"Do you think video games cause violence?",
"Is water wet?",
"What do you think about cryptocurrency?",
"Do you believe in ghosts?",
"Should college education be free?",
"Is it okay to put ketchup on eggs?",
"Which is better: DC or Marvel?",
"Do you think the moon landing was faked?",
"Should we fund space exploration or focus on Earth's issues?",
"Do you believe in the existence of Bigfoot?",
"Is cereal a soup?",
"What's your opinion on social media?",
"Are you a flat-earther?",
"What do you think about time travel?",
"Do you think robots will eventually replace humans?",
"Which came first: the chicken or the egg?",
"Should we be investing more in renewable energy?",
"Do you think reality TV is harmful?",
"What's your stance on gun control?",
"Is a tomato a fruit or a vegetable?",
"Do you think we live in a simulation?",
"Is Pluto a planet?",
"Should internet access be a basic human right?",
"Do you believe in multiple universes?",
"What's your opinion on genetically modified organisms?",
"Should we be concerned about privacy in the digital age?",
"Do you think humans will ever achieve immortality?",
"What do you think about the idea of a Universal Basic Income?",
"Are you an introvert or an extrovert?",
"Which is better: Netflix or Hulu?",
"Is it ethical to eat meat?",
"Should we colonize Mars?",
"Do you think money can buy happiness?",
"Is there such a thing as objective morality?",
"What do you think about the future of virtual reality?",
"Do you think online learning is effective?",
"What's your opinion on the death penalty?",
"Do you think we should legalize all drugs?",
"Is it ethical to use animals for testing?",
"What do you think about the gig economy?",
"Should voting be mandatory?"
)
),
FOUND_PLAYER(
arrayOf(
"hey could you plz hop??",
"hippity hoppity?",
"kindly plz leave dude?? i've been here for a while..",
"sorry, I was here first. Can you find another world?",
"please switch worlds, I've been grinding here.",
"could you hop to another world, please?",
"hey, I've been here for hours, mind hopping?",
"would you mind hopping to another world?",
"I've been training here for a while, can you hop, please?",
"I'd appreciate it if you could hop to a different world.",
"can you please switch worlds? I've been working on this spot.",
"I've been here for ages, could you please hop?",
"hey, do you mind hopping to another world?",
"please hop, I've been training here for quite some time.",
"I've been grinding this spot for a while, can you hop?",
"please find another world, I've been here for a long time.",
"I'd really appreciate it if you could hop to another world.",
"hey there, can you please switch to a different world?",
"I've been here for hours, can you please hop?",
"I've been grinding this spot, could you find another world, please?"
)
),
WAITING_AND_FOUND_PLAYER(
arrayOf(
"please hop dude im just waiting for my hp to heal back",
"hey bro, just waiting for my hp, sup lol",
"wassup lol, just chillin",
"had to leave, someone at the door",
"girlfriend called, had to answer lmao",
"taking a break, be back in a bit",
"just grabbing a snack, hold on",
"hey, I was here first, just waiting to recover",
"needed a quick break, be back soon",
"got a phone call, will be back shortly",
"had to step away for a sec, be right back",
"my pet needed attention, I'll be back soon",
"just waiting for my health to regenerate",
"brb, need to grab a drink",
"had to answer the door, I'll be back soon",
"needed a quick bathroom break, brb",
"hey, just taking a break, be back in a few",
"just stretching my legs, I'll be back shortly",
"I was here first, just taking a short break",
"I'll be back in a minute, just had to grab something"
)
);
override fun getRandomMessage() = responses.random()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment