Skip to content

Instantly share code, notes, and snippets.

@MikeGrace
Created June 9, 2010 00:10
Show Gist options
  • Save MikeGrace/430835 to your computer and use it in GitHub Desktop.
Save MikeGrace/430835 to your computer and use it in GitHub Desktop.
ruleset a60x262 {
meta {
name "talkative rules"
description <<
talkative rules
>>
author "Mike Grace"
logging on
}
dispatch {}
global {
choices = ["one","two","three","four","five","six"];
}
rule setup_chat is active {
select when pageview ".*"
pre {
chatRoom = <<
<script>connect = {}</script>
>>;
}
{
append("head",chatRoom);
}
}
rule randomly_pick_number is active {
select when pageview ".*"
{
notify("Not random, random number",choices[0]) with sticky = true;
emit <<
connect.random = choices[0];
>>;
}
}
rule what_was_picked is active {
select when pageview ".*"
pre {
toBeInserted = <<
-> <span id="random-random"></span> <-
>>;
}
{
notify("The previous rule not so randomly picked the random number of", toBeInserted) with sticky = true;
emit <<
$K("#random-random").append(connect.random);
>>;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment