View Single Post
Repeater07
Junior Member
 
Join Date: Aug 2014
Posts: 11

Old August 5th, 2014, 12:36 PM
I couldn't find a way to do this, but I was able to create one using html attachments. It would be by nice if this was a feature in line, but I figured I would share what I did, in case others have the same use.

I come across a lot of tables that you roll results for (such as critical hit lists or miss lists), so I wanted some way to have a button that randomly selects from that list.

What I did was a simple javascript and I do an add HTML (complete) to have the javascript code, then you can select the html and it will pull it up. here is an example:

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>Moods and Attitudes</TITLE>
</HEAD>
<BODY>

<script language="JavaScript">
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};

function rand(number) {
return Math.ceil(rnd()*number);
};

function makeArray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this[i] = "";
return this;
} ;// End of function makeArray

function BitchRule() {
var WIndex = rand(6) ;
RClass = new makeArray(7);
RClass[0] = "happy, cheerful, optimistic, helpful, friendly";
RClass[1] = "happy, cheerful, optimistic, helpful, friendly";
RClass[2] = "self-pity, unhelpful, brooding, pessimistic";
RClass[3] = "pissed off, vengeful, cruel";
RClass[4] = "playful, energetic, daring, foolhardy, practical joker";
RClass[5] = "vain, proud, lazy, bored, omnipotent feeling";
RClass[6] = "restless, impatient, takes control, urge to get on with things, roll 1d6 for obsession check";
return RClass[WIndex];
};
</script>

<form>
<input type="button" name="Button1" value="Moods and Attitudes" onClick="this.form.textField1.value = BitchRule()" size="" />
<textarea name="textField1" cols="40" rows="1" wrap="soft"></textarea>
</form>

</BODY>
</HTML>
Repeater07 is offline   #2 Reply With Quote