Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Plugins
➜ Everyone in the room random and keep track of their number
Everyone in the room random and keep track of their number
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Horologe
(9 posts) Bio
|
Date
| Fri 22 May 2015 07:27 PM (UTC) |
Message
| Basically what this plugin is supposed to do is detect all the players in the room and then point at them one by one. Once the player that is point at "randoms" then something to this effect is output to everyone in the room.
Quote: The Joker says to you, 'Perhaps this number will bring you luck!'
He blows a cloud of smoke which slowly forms the number 13.
Then, with a wink and a smile, he is gone.
The person running the plugin automatically points at everyone in the room to random. Once everyone randoms then the numbers are output in high->low ordering.
I can get rvt to work. I can't get rvr to work. I don't want to have to manually enter everyone's name.
Please let me know if you see flaws in what i have.
http://pastebin.com/EbzYaNp1
I tried to use the code bbc codes but there were too many characters. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 22 May 2015 11:54 PM (UTC) |
Message
| Here is your code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, April 24, 2013, 1:37 AM -->
<!-- MuClient version 4.84 -->
<!-- Plugin "RVR" generated by Plugin Wizard -->
<muclient>
<plugin
name="RVR"
author="Afraidofhawk"
id="c15ec45c139e475ee736ca0d"
language="JScript"
purpose="Random vs Relics"
save_state="y"
date_written="2013-04-24 01:36:17"
requires="4.84"
version="1.0"
>
<description trim="y">
<![CDATA[
Used to sort randomers ascending and descending.
]]>
</description>
</plugin>
<!-- Get our standard constants -->
<include name="constants.js"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
group="RVR"
match="^[(.+)/(.+)][(.+)/(.+)][(.+)] (.+)"
name="rvr_poll"
regexp="y"
send_to="12"
sequence="100"
>
<send>var whoraw = "%6".split(' ');
var dude = whoraw[0];
var undefined;
if(playerList == undefined) {
var playerList = new Array();
};
var found = false;
for (i = 0; i < playerList.length && !found; i++) {
if (playerList[i] == dude) {
found = true;
}
};
if (!found) {
var playerIndex = playerList.length;
playerList[playerIndex] = dude;
};</send>
</trigger>
<trigger
enabled="y"
group="RVR"
match="^He blows a cloud of smoke which slowly forms the number (.+)."
name="rvr_randoming"
regexp="y"
send_to="12"
sequence="100"
>
<send>var RandomNum = %1;
var inList = false;
for (i = 0; i < RVRPlayers.length && !inList; i++) {
if (RVRPlayers[i] == Randomer) {
inList = true;
}
};
if(inList) {
if(RandomList.length < 1) {
RandomList[0] = new Array(RandomNum,Randomer);
RVRround++;
world.send("point " + RVRPlayers[RVRround-1]);
};
var found = false;
for (i = 0; i < RandomList.length && !found; i++) {
if (RandomList[i][1] == Randomer) {
found = true;
}
};
if(!found) {
var i = 0;
var ltTrue = false;
while(!ltTrue && i < RandomList.length) {
if (RandomNum < RandomList[i][0]) {
ltTrue = true;
};
if(!ltTrue) {
i++;
}
};
RandomList.splice(i,0,new Array(RandomNum,Randomer));
RVRround++;
if(RVRround > RVRrounds) {
world.EnableTrigger("rvr_randoming",false);
world.EnableTrigger("rvr_jokerid",false);
var RandTemp = "";
if(RVROrder == "up") {
for (i=0;i < RandomList.length;i++) {
RandTemp = RandTemp + " " + RandomList[i][1] + " " + RandomList[i][0] + ",";
};
RandTemp = RandTemp.substring(0, RandTemp.length - 1);
};
if(RVROrder != "up") {
for (i=RandomList.length;i > 0;i--) {
RandTemp = RandTemp + " " + RandomList[i-1][1] + " " + RandomList[i-1][0] + ",";
};
RandTemp = RandTemp.substring(0, RandTemp.length - 1);
};
world.send("say The results are: " + RandTemp);
};
if(RVRround <= RVRrounds) {
world.send("point " + RVRPlayers[RVRround-1]);
}
}
}
</send>
</trigger>
<trigger
enabled="y"
group="RVR"
match="^The Joker says to (.+),"
name="rvr_jokerid"
regexp="y"
send_to="12"
sequence="100"
>
<send>var Randomer = "%1";</send>
</trigger>
<trigger
group="RVR"
match="^Obvious exits:"
name="rvr_startrand"
regexp="y"
send_to="12"
sequence="100"
>
<send>world.EnableTrigger("rvr_getplayers",false);
world.EnableTrigger("rvr_startrand",false);
var RVRrounds = RVRPlayers.length;
var RVRround = 1;
var RandomList = new Array();
world.send("say Random when I point at you...");
world.send("point " + RVRPlayers[RVRround-1]);
world.EnableTrigger("rvr_randoming",true);
world.EnableTrigger("rvr_jokerid",true);</send>
</trigger>
<trigger
back_colour="8"
group="RVR"
match="*"
match_back_colour="y"
match_text_colour="y"
name="rvr_getplayers"
send_to="12"
sequence="100"
text_colour="10"
>
<send>var whoraw = "%1".split(' ');
var dude = whoraw[0];
var undefined;
if(playerList == undefined) {
var playerList = new Array();
};
var found = false;
for (i = 0; i < playerList.length && !found; i++) {
if (playerList[i] == dude) {
found = true;
}
};
if (found) {
var undefined;
if(RVRPlayers == undefined) {
var RVRPlayers = new Array();
};
var RVRnum = RVRPlayers.length;
RVRPlayers[RVRnum] = dude;
};</send>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
<alias
name="rvr_init"
match="^rvr (.+)"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>world.EnableTrigger("rvr_getplayers",true);
world.EnableTrigger("rvr_startrand",true);
var RVRPlayers = new Array();
var RVROrder = "%1";
world.send("look");
</send>
</alias>
<alias
name="rvr_test"
match="^rvt"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>world.EnableTrigger("rvr_getplayers",false);
world.EnableTrigger("rvr_startrand",false);
var RVRPlayers = new Array("PlayerA","PlayerB");
var RVROrder = "%1";
var RVRrounds = RVRPlayers.length;
var RVRround = 1;
var RandomList = new Array();
world.send("say Random when I point at you...");
world.send("point " + RVRPlayers[RVRround-1]);
world.EnableTrigger("rvr_randoming",true);
world.EnableTrigger("rvr_jokerid",true);</send>
</alias>
<alias
name="rvr_inject"
match="^rvi"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>var RVRPlayers = new Array("Afraidofhawk","Apocalypse","Ragnarok");</send>
</alias>
</aliases>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="RVR:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
function OnHelp (sName, sLine, wildcards)
{
world.Note (world.GetPluginInfo (world.GetPluginID, 3));
}
]]>
</script>
</muclient>
However my JScript skills aren't really up to debugging it. How about showing us what you see (the people in the room)? Get some example output. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,318 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top