“Who Wants to play KARMA ROULETTE!™?”

macros macros macros

Moderators: Phineas, noivad

Post Reply
User avatar
noivad
Order of the White Elephant
Order of the White Elephant
Posts: 3333
Joined: Wed Oct 08, 2003 4:04 pm
Profession: Fighter
Race: Sylvan
Player Status: Active
Location: SF Bay Area
Contact:

“Who Wants to play KARMA ROULETTE!™?”

Post by noivad » Sat Mar 17, 2012 4:27 pm

Hello,
A month or so ago, Stinkfist and I were joking about making a karma roulette macro, which he offered to test. I wrote it back then but never tested it until today. After a bit bugginess thanks to thinking in a different scripting language, I got it to work.
This macro is triggered by the default phrase I want to play karma roulette # (with the number being your seed number for the game). It kicks out either a 0 or 1 which either curses or blesses the player. It is as random as the random number generator in the macro language. (BTW: does anyone know if it is the same one used in the game?) This is a .mac file but for Windows peeps, I'm posting it here. I will probably put it up on the CLUMP in the macros section once I refine it and get rid of the sloppy code. Please only use your macro modification powers for good.

If you already have a scanning macro you can just insert this set of lines into it (assuming you declared the text log as scanText like this:

Code: Select all

set @env.textLog scanText
then just drop this into your scanning macro

Code: Select all

else if  scanText < "I want to play karma roulette" //change the trigger phrase if you want to have another phrase trigger it
setglobal rouletteTarget scanText.word[playerName]
setglobal roulettenumber scanText.word[10] //change this to "8" if you do not use timestamps
call KarmaRoulette
you can make the trigger whatever you would like and then have as the action.

Here's a very unoptimized version of Karma Roulette. I could easily eliminate a few global variables by redeclaring them, but I was just playing a around:

Code: Select all

//Karma Roulette (For fun and non-profit v.1 by )
set rouletteTarget ""
set fate[0] "/curse "
set fate[1] "/thank "
set fateMessage[0] "very bad!"
set fateMessage[1] "very good!"

KarmaRoulette 
{
	set randomFateNum @random
	//If the person chose a number then set it as the seed, or else chose one at random
	if roulettenumber != ""
		if roulettenumber > 0
			set seed roulettenumber
		else if roulettenumber == 0
			set seed @random
			"trying to trick me eh?"
		else 
			roulettenumber " is not an integer\r"
			set seed @random
		end if
	else 
		pause 4
		set seed @random
		message "Chosen seed is " seed
		pause 2
		message "Fate Number is " randomFateNum
		set noNum 1
	end if
	
	//If the seed is greater than the random fate number multiply it by yet another random number
	if seed > randomFateNum
		set randomFateNum * @random
	end if
	//now we reduce the number by modulus of the seed, then reduce that by the modulus of 2 (reducing the outcome to either a 1 or 0)
	 set fatenum randomFateNum 
	 set fatenum % seed
	 set fatenum % 2

if rouletteTarget != @my.name
	rouletteTarget " you've chosen to play karma roulette\r"
	pause 5
	"prepare to face your fate\r"
	pause 8
	 if noNum == 1
	 	"You didn't choose a number " rouletteTarget " so your number is " seed "\r"
	 end if
	 if fatenum < 2
		rouletteTarget " your fate is to be " fateMessage[fatenum] "\r"
		pause 6
		fate[fatenum] " " rouletteTarget " thank you for playing Karma Roulette!\r"
	else 
		message fatenum
	end if
else 
	message "debug mode seed=" seed
	message "Fate Number was=" randomFateNum
	pause 4
	message "that would have been " fateMessage[fatenum]
end if
}
BTW: I actually have a timestamp detector I just need to include in a second version, but if you would like to do it, here it the raw code to include in @login:

Code: Select all

	set scanText @env.textLog
	if scanText.word[0] < "/"
		setglobal timeStamps 2
	else
		setglobal timeStamps 0
	end if
then you could just add the timestamps:

Code: Select all

 
set numberPosition 8 //this is only if you use the default phrase by the way
set numberPosition + timestamps 
roulettenumber scanText.word[numberPosition]
There's probably a way to skim the log for numbers, but if there is I forgot how to do it. Also you could modify it to pull out the number of letters or words in the text log as the seed with something like this:

Code: Select all

setglobal seed @envTextlog.num_letters
or

Code: Select all

setglobal seed @envTextlog.num_words
http://www.clanlord.net/
Org Du Lac's bestiary: http://bestiary.clanlord.net/index.html
Gil Galad’s Pirates http://pirates.clanlord.net/ & Ranger Studies: http://studies.clanlord.net/
?security warning:View cert•CL players assess valid by refs

Post Reply