Guest
Public paste!

Untitled

By: a guest | Jul 4th, 2009 | Syntax: None | Size: 26.78 KB | Hits: 9 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. import java.awt.*;
  2. import java.awt.event.*;
  3.  
  4. import com.speljohan.rsbot.plugin.*;
  5. import com.speljohan.rsbot.script.*;
  6. import com.speljohan.rsbot.bot.*;
  7. import com.speljohan.rsbot.script.wrappers.*;
  8. import com.speljohan.rsbot.event.listeners.*;
  9. import com.speljohan.rsbot.event.events.*;
  10. import com.speljohan.rsbot.accessors.*;
  11.  
  12. //Importing all the Script functions and Wrappers (Objects, NPC's, Characters)
  13.  
  14. public class ChatResponderModded extends Random {  
  15. public int dyingAnimation = 836;
  16.     String reply="NO REPLY";
  17.     String textSent;
  18.     String[] oldQ = {""};
  19.     long nextTalk = System.currentTimeMillis()+random(160000,170000*random(2,4));
  20.     long lastCheck = -1;//lets make it do a check at the start
  21.     String[] attackNames = {"Attack", "attack", "ATT", "Att", "att"};
  22.     String[] defenseNames = {"Defence", "defence", "Defense", "defense", "DEF", "Def", "def"};
  23.     String[] strengthNames = {"Strength", "strength", "STR", "Str", "str"};
  24.     String[] hitpointsNames = {"Hitpoints", "hitpoints", "HP", "Hp", "hp", "Hits", "hits"};
  25.     String[] rangeNames = {"Range", "range", "Ranged", "ranged"};
  26.     String[] prayerNames = {"Prayer", "prayer", "Pray", "pray"};
  27.     String[] magicNames = {"Magic", "magic", "Mage", "mage"};
  28.     String[] cookingNames = {"Cooking", "cooking", "Cook", "cook"};
  29.     String[] woodcuttingNames = {"Woodcutting", "woodcutting", "WC", "Wc", "wc"};
  30.     String[] fletchingNames = {"Fletching", "fletching", "Fletch", "fletch"};
  31.     String[] fishingNames = {"Fishing", "fishing", "Fish", "fish"};
  32.     String[] firemakingNames = {"Firemaking", "firemaking", "Firemake", "firemake", "FM", "Fm", "fm"};
  33.     String[] craftingNames = {"Crafting", "crafting", "Craft", "craft"};
  34.     String[] smithingNames = {"Smithing", "smithing", "Smith", "smith"};
  35.     String[] miningNames = {"Mining", "mining", "Mine", "mine"};
  36.     String[] herbloreNames = {"Herblore", "herblore", "Herb", "herb"};
  37.     String[] agilityNames = {"Agility", "agility", "Agil", "agil"};
  38.     String[] thievingNames = {"Thieving", "thieving", "Theif", "thief"};
  39.     String[] slayerNames = {"Slayer", "slayer", "Slay", "slay"};
  40.     String[] runecraftingNames = {"Runecrafting", "runecrafting", "Runecraft", "runecraft", "RC", "Rc", "rc"};
  41.     String[] farmingNames = {"Farming", "farming", "Farm", "farm"};
  42.     String[] hunterNames = {"Hunting", "hunting", "Hunter", "hunter"};
  43.     String[] constructionNames = {"Construction", "construction", "constructing", "constructing"};
  44.     String[] summoningNames = {"Summoning", "summoning", "Summon", "summon"};
  45.     public String statName(int stat) {
  46.         if(stat == STAT_ATTACK)
  47.             return pickRandomName(attackNames);
  48.         if(stat == STAT_DEFENSE)
  49.             return pickRandomName(defenseNames);
  50.         if(stat == STAT_STRENGTH)
  51.             return pickRandomName(strengthNames);
  52.         if(stat == STAT_HITPOINTS)
  53.             return pickRandomName(hitpointsNames);
  54.         if(stat == STAT_RANGE)
  55.             return pickRandomName(rangeNames);
  56.         if(stat == STAT_PRAYER)
  57.             return pickRandomName(prayerNames);
  58.         if(stat == STAT_MAGIC)
  59.             return pickRandomName(magicNames);
  60.         if(stat == STAT_COOKING)
  61.             return pickRandomName(cookingNames);
  62.         if(stat == STAT_WOODCUTTING)
  63.             return pickRandomName(woodcuttingNames);
  64.         if(stat == STAT_FLETCHING)
  65.             return pickRandomName(fletchingNames);
  66.         if(stat == STAT_FISHING)
  67.             return pickRandomName(fishingNames);
  68.         if(stat == STAT_FIREMAKING)
  69.             return pickRandomName(firemakingNames);
  70.         if(stat == STAT_CRAFTING)
  71.             return pickRandomName(craftingNames);
  72.         if(stat == STAT_SMITHING)
  73.             return pickRandomName(smithingNames);
  74.         if(stat == STAT_MINING)
  75.             return pickRandomName(miningNames);
  76.         if(stat == STAT_HERBLORE)
  77.             return pickRandomName(herbloreNames);
  78.         if(stat == STAT_AGILITY)
  79.             return pickRandomName(agilityNames);
  80.         if(stat == STAT_THIEVING)
  81.             return pickRandomName(thievingNames);
  82.         if(stat == STAT_SLAYER)
  83.             return pickRandomName(slayerNames);
  84.         if(stat == STAT_RUNECRAFTING)
  85.             return pickRandomName(runecraftingNames);
  86.         if(stat == STAT_FARMING)
  87.             return pickRandomName(farmingNames);
  88.         if(stat == STAT_HUNTER)
  89.             return pickRandomName(hunterNames);
  90.         if(stat == STAT_CONSTRUCTION)
  91.             return pickRandomName(constructionNames);
  92.         if(stat == STAT_SUMMONING)
  93.             return pickRandomName(summoningNames);
  94.         return null;
  95.     }
  96.     public void talk() {
  97.         long currentTime = System.currentTimeMillis();
  98.         long minutes = (currentTime-lastCheck)/(60000);
  99.         if(lastCheck == -1) {
  100.             for(int i=0;i<training.length;i++)
  101.                 oldXP[i] = skills.getCurrentSkillExp(i);
  102.         }
  103.         if(minutes >= 1) {
  104.             lastCheck = System.currentTimeMillis();
  105.             for(int i=0;i<training.length;i++) {
  106.                 if(oldXP[i] != skills.getCurrentSkillExp(i)) {
  107.                     if(training[i] <= 5)
  108.                         training[i]++;
  109.                 } else {
  110.                         training[i] = 0;
  111.                 }
  112.             }
  113.             for(int i=0;i<training.length;i++)
  114.                 oldXP[i] = skills.getCurrentSkillExp(i);
  115.         }
  116.             int biggest=-1;
  117.             int biggestNum = -1;
  118.             for(int i=0;i<training.length;i++) {
  119.                 if(training[i] > biggest && training[i]>0) {
  120.                     biggest = training[i];
  121.                     biggestNum = i;
  122.                 }
  123.             }
  124.             if(biggest > 0)
  125.                 talk2(biggestNum);
  126.     }
  127.     public String xpToString(int level) {
  128.         String[] extraArray = {"","","","","","","","","","","","","","","","","","",
  129.                                "","","","","","","","","","","","","","","","","","",
  130.                                "","","","","","","","","","","","","","","","","","",
  131.                                "","","","","","","","","","","","","","","","","","",
  132.                                ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  133.                                ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  134.                                ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  135.                                ". =\\", ".=\\", " =\\", "=\\", ". =O", ".=O", " =O", "=O",
  136.                                ". =)", ".=)", " =)", "=)", ". =]", ".=]", " =]", "=]",
  137.                                ". =P", ".=P", " =P", "=P", ". =D", ".=D", " =D", "=D",
  138.                                };
  139.         int percent = skills.getPercentToNextLevel(level);
  140.         int xpTo = skills.getXPToNextLevel(level);
  141.         int skillLevel = skills.getCurrentSkillLevel(level);
  142.         String only = "";
  143.         String temp = "";
  144.         String[] toArray = {"to", "to", "to", "2", "till", "till", "until", "until"};
  145.         String to=toArray[random(0,toArray.length)];
  146.         String[] onlyArray = {"only", "just"};
  147.         if(percent < 20 && random(1,5) == 3) {
  148.             only=onlyArray[random(0,1)]+" ";
  149.         }
  150.         String k = "k";
  151.         String m = "m";
  152.         if(random(0,2) == 0) {
  153.             k="K";
  154.             m="M";
  155.         }
  156.         if(xpTo > 1000000)
  157.             temp = xpTo/1000000+m;
  158.         else if(xpTo > 1000)
  159.             temp = xpTo/1000+k;
  160.         else
  161.             temp = ""+xpTo;
  162.         String[] moreArray = {"to go", "more", "left", "To Go", "More", "Left"};
  163.         String more=moreArray[random(0,moreArray.length)];
  164.         String[] xpArray = {"xp", "XP", "Xp", "EXP", "Exp", "exp", "Experience", "experience"};
  165.         String xp=xpArray[random(0,xpArray.length)];
  166.         String[] levelArray = {"Lvl", "LVL", "lvl",
  167.                                "Lev", "lev", "LV", "lv", "Lv", "Level", "level"};
  168.         String lvl = levelArray[random(0,levelArray.length)];
  169.         String[] talkArray = {only+temp+xp+" "+more+" "+to+" "+lvl+" "+(skillLevel + 1), only+temp+" "+statName(level)+" "+xp+" "+more+" "+to+" "+lvl+" "+(skillLevel + 1),
  170.                               "i "+only+"need "+temp+" "+xp+" "+more+" "+to+" "+lvl+" "+skillLevel, "i "+only+"need "+temp+" "+statName(level)+" "+xp+" "+more+" "+to+" "+lvl+" "+(skillLevel + 1)};
  171.         return talkArray[random(0,talkArray.length)]+extraArray[random(0,extraArray.length)];
  172.     }
  173.     public void hoverInterface(int iface, int child) {
  174.         hoverInterface(RSInterface.getChildInterface(iface, child));
  175.     }
  176.  
  177.     public void hoverInterface(RSInterfaceChild i) {
  178.         if (!i.isValid()) return;
  179.         Rectangle pos = i.getArea();
  180.         moveMouse((int) random(pos.getMinX(), pos.getMaxX()), (int) random(pos.getMinY(), pos.getMaxY()));
  181.     }
  182.     public void talk2(int skill) {
  183.         if(nextTalk > System.currentTimeMillis())
  184.             return;
  185.         nextTalk = System.currentTimeMillis()+random(140000,160000*random(2,4));
  186.         if(getNearestPlayerDistance() >=5) //nobodys close enough to talk to.
  187.             return;
  188.         String[] extraArray = {"","","","?","?","?","."};
  189.         String extra=extraArray[random(0,extraArray.length)];
  190.         int gamble = random(1,3);
  191.         String stat = statName(skill);
  192.         int level = skills.getCurrentSkillLevel(skill);
  193.         String only = "";
  194.         String[] onlyArray = {"only", "just"};
  195.         if(level < 30 && random(1,5) == 3) {
  196.             only=onlyArray[random(0,1)]+" ";
  197.         }
  198.         String[] extraArray2 = {"","","","","","","","","","","","","","","","","","",
  199.                                "","","","","","","","","","","","","","","","","","",
  200.                                "","","","","","","","","","","","","","","","","","",
  201.                                "","","","","","","","","","","","","","","","","","",
  202.                                ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  203.                                ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  204.                                ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  205.                                ". =\\", ".x[)", " =\\", " lol", ". =O", ".=O", " =O", "=O",
  206.                                ". =)", ".=)", " =)", "=)", ". =]", ".=]", " =]", "=]",
  207.                                ". =P", ".=P", " =P", "=P", ". =D", ".=D", " =D", "=D",
  208.                                };
  209.         String extra2=extraArray2[random(0,extraArray2.length)];
  210.         String[] levelArray = {"", "", "", "", "", "Lvl ", "LVL ", "lvl ",
  211.                                "Lev ", "lev ", "LV ", "lv ", "Lv ", "Level ", "level "};
  212.         String lvl = levelArray[random(0,levelArray.length)];
  213.         String[] misc1 = {"what's your", "wuts ur", "whats your", "what's your", "quts yur"};
  214.         String[] echoMineArray = {"mine is "+only+lvl+level, "mine is "+only+lvl+level, "mine is "+only+lvl+level, only+lvl+level+" here",
  215.                                    only+lvl+level+" over here"};
  216.         String echoMine = echoMineArray[random(0,echoMineArray.length)];
  217.         if(gamble == 1) {
  218.             textSent = misc1[random(0,misc1.length)]+" "+stat+" level"+extra;
  219.             sendText(textSent,true);
  220.             wait(random(100,300));
  221.             if(random(0,21) != 20) //one in 20 chance it wont say your level back.
  222.                 wait(random(6000,7000));
  223.                 sendText(echoMine+extra2,true);
  224.         } else if(gamble == 2) {
  225.             int oldTab = getCurrentTab();
  226.             openTab(TAB_STATS);
  227.             wait(random(100,200));
  228.             hoverInterface(320,125+random(0,5));
  229.             wait(random(500,2000));
  230.             String text = xpToString(skill);
  231.             System.out.println("\n\n\n"+text+"\n\n\n");
  232.             sendText(text, true);
  233.             openTab(oldTab);
  234.         }
  235.     }
  236.  
  237.     public String getName() {  //Name of the Script
  238.         return "ChatResponderImproved";   //between "" what will show up in RSBot script selector
  239.     }
  240.  
  241.     public double getVersion() {   //Version of the Script
  242.         return 1.0;       //what will show up in RSBot script selector
  243.     }
  244.  
  245.     public String getAuthor() { //Author of the Script
  246.         return "Mike, ToshiXZ & Tejanca";   //what will show up in RSBot script selector
  247.     }
  248.     public boolean onStart(String[] args) {  //First thing run, when a Script is started (holds an array called "args" which contain the arguments put in by user in Script Selector
  249.         return true;   //return true = Start Script; return false = Don't Start Script
  250.     }
  251.  
  252.     public String getChildText(int iface, int child) {
  253.         return RSInterface.getInterface(iface).getChild(child).getText();
  254.     }
  255.     public String[] getChatMessages(boolean stripName) {
  256.         String[] temp = new String[100];
  257.         int tempi=0;
  258.         for(int i=155; i >= 56; i--)
  259.             if(getChildText(137,i).contains("<col=0000ff>")) {
  260.                 if(stripName) {
  261.                     temp[tempi] = getChildText(137,i).substring(getChildText(137,i).indexOf("<col=0000ff>")+12);
  262.                     tempi++;
  263.                 } else {
  264.                     temp[tempi] = getChildText(137,i).replaceAll("<col=0000ff>", "");
  265.                     tempi++;
  266.                 }
  267.             }
  268.         return temp;
  269.     }
  270.     String oldChat = "";
  271.     String[] chat = new String[100];
  272.     String[] chat2 = new String[100];
  273.     int[] training = new int[STAT_SUMMONING];
  274.     int[] oldXP = new int[STAT_SUMMONING];
  275.     public boolean activateCondition() {  //Main function of the Script
  276.         reply();
  277.         talk();
  278.         return false;
  279.     }
  280.     public void reply() {
  281.         chat = getChatMessages(true);
  282.         chat2 = getChatMessages(false);
  283.         if(chat[0] == null || oldChat.equalsIgnoreCase(chat2[0]))
  284.             return;
  285.                 if (oldQ[0].equalsIgnoreCase(chat2[0]))
  286.                 return;
  287.         String temp=chat2[0];
  288.         String name = temp.substring(0,temp.indexOf(":"));
  289.         if(name.equalsIgnoreCase(getMyPlayer().getName()))
  290.             return;
  291.         if(replyToPlayer(chat[0])) {
  292.             log("ChatResponder is replying to: ");
  293.             log(chat2[0]);
  294.             log("Successfully replied with:");
  295.                         log(reply);
  296.             oldQ[0] = chat2[0];
  297.         }
  298.     }
  299.     public int loop() {
  300.         return -1; //wtf? this shouldn't be called.
  301.     }
  302.     public String pickRandomName(String[] possible) { //it needs to USUALLY pick the first two.
  303.         if(random(0,5) == 3)
  304.                return possible[random(0,possible.length)];
  305.            else
  306.                return possible[random(0,1)];
  307.     }
  308.     public boolean replyToPlayer(String text) {
  309.         text=text.toLowerCase();
  310.         reply="NO REPLY";
  311.         Boolean doPrefix = true;
  312.         int oldTab = -1;
  313.  
  314.                
  315.                 if (getMyPlayer().getAnimation() == dyingAnimation){
  316.                 String[] deathArray = {"crap","well that sucks","oh man","dang it","F T L...sigh"};
  317.         String death=deathArray[random(0,deathArray.length)];
  318.         sendText(death,true);
  319.         reply=death;
  320.         return true;
  321.         }
  322.  
  323.         if (text.contains("botting?") || text.contains("ur a bot") || text.contains("bot?") || text.contains("macro?") || text.contains("bot..")) {
  324.         String[] bottingArray = {"botting is lame","bots r for losers!","id never bot","lol botting fails","i sure ain't a bot","nah","i dont bot!","i've never botted before"};
  325.         String botting=bottingArray[random(0,bottingArray.length)];
  326.         sendText(botting,true);
  327.         reply=botting;
  328.         return true;
  329.         }
  330.         if (text.contains("im bored") || text.contains("i'm bored") || text.contains("i am bored") || text.contains("i ma bored")) {
  331.         String[] boredArray = {"me too", "i am not", "*yawn* me too", "so am i","i am also","nice to meet you bored :)","nice to meet you bored","i'm not","im not","im not, im just tired"};
  332.         String bored=boredArray[random(0,boredArray.length)];
  333.         sendText(bored,true);
  334.         reply=bored;
  335.         return true;
  336.         }
  337.  
  338.         if (text.contains("w00t") || text.contains("woot") || text.contains("w00t") || text.contains("yipee") || text.contains("yay!")) {
  339.         String[] wootArray = {"Gratz", "congratz", "congratulations", "lol gratz?"};
  340.         String woot=wootArray[random(0,wootArray.length)];
  341.         sendText(woot,true);
  342.         reply=woot;
  343.         return true;
  344.         }
  345.  
  346.         if (text.contains("sup") || text.contains("wazup") || text.contains("nmu") || text.contains("sup")  || text.contains("s up?")) {
  347.         String[] supArray = {"meh, not much","nothing much","nmu","meh, nothing really","nothing, bored"};
  348.         String sup=supArray[random(0,supArray.length)];
  349.         sendText(sup,true);
  350.         reply=sup;
  351.         return true;
  352.         }
  353.                
  354.                 if (text.contains("k till") || text.contains("k untill")) {
  355.         String[] ktillArray = {"thats nice","cool, good luck","good luck","nice","that's nice","sweet","wow","gratz"};
  356.         String ktill=ktillArray[random(0,ktillArray.length)];
  357.         sendText(ktill,true);
  358.         reply=ktill;
  359.         return true;
  360.         }
  361.                
  362.                 if (text.contains("m till") ||text.contains("m untill")) {
  363.         String[] mtillArray = {"holy sheet","wow","dang!","dang","holy smokes","w0w","good luck!","good luck"};
  364.         String mtill=mtillArray[random(0,mtillArray.length)];
  365.         sendText(mtill,true);
  366.         reply=mtill;
  367.         return true;
  368.         }
  369.                
  370.   if (text.contains("why are you doing that") || text.contains("why are you doin that") || text.contains("y r u doing that")) {
  371.         String[] looperrorArray = {"'cuz i can","because i want to","why not?","why aren't you?!","it makes people mad"};
  372.         String looperror=looperrorArray[random(0,looperrorArray.length)];
  373.         sendText(looperror,true);
  374.         reply=looperror;
  375.         return true;
  376.         }
  377.  
  378.         if (text.contains("cya") || text.contains("bye") || text.contains("c ya") || text.contains("later") || text.contains("seeya")) {
  379.         String[] cyaArray = {"later","bye","seeya!","cya","ok bye then"};
  380.         String cya=cyaArray[random(0,cyaArray.length)];
  381.         sendText(cya,true);
  382.         reply=cya;
  383.         return true;
  384.         }
  385.                
  386.         if (text.endsWith("hi") || text.contains("Hey") || text.contains("Yo")  || text.contains("Helow") || text.contains("Hello") || text.startsWith("Hi") && text.indexOf("fish") == -1  && text.indexOf("smithing") == -1  && text.indexOf("hitp") == -1  && text.indexOf("which") == -1  && text.indexOf("the") == -1  && text.indexOf("not") == -1  && text.indexOf("high") == -1  && text.indexOf("this") == -1) {
  387.         String[] greetingArray = {"hey","yo man","hi","yo","hello","greetings","hi :)"};
  388.         String greeting=greetingArray[random(0,greetingArray.length)];
  389.         sendText(greeting,true);
  390.         reply=greeting;
  391.         return true;
  392.         }
  393.  
  394.         if((text.contains("level") || text.contains("lv")) && (text.indexOf(" ") == text.lastIndexOf(" ") || text.startsWith("what") || text.endsWith("?") || text.endsWith("lv") || text.endsWith("lvl") || text.endsWith("lev") || text.endsWith("level"))) { //asking for a level
  395.             int whichSkill = -1;
  396.             String statName;
  397.             if(text.contains("att")) {
  398.                 whichSkill = STAT_ATTACK;
  399.                 statName=pickRandomName(attackNames);
  400.             } else if(text.contains("def")) {
  401.                 whichSkill = STAT_DEFENSE;
  402.                 statName=pickRandomName(defenseNames);
  403.             } else if(text.contains("str")) {
  404.                 whichSkill = STAT_STRENGTH;
  405.                 statName=pickRandomName(strengthNames);
  406.             } else if(text.contains("hp") || text.contains("hit")) {
  407.                 whichSkill = STAT_HITPOINTS;
  408.                 statName=pickRandomName(hitpointsNames);
  409.             } else if(text.contains("range")) {
  410.                 whichSkill = STAT_RANGE;
  411.                 statName=pickRandomName(rangeNames);
  412.             } else if(text.contains("pray")) {
  413.                 whichSkill = STAT_PRAYER;
  414.                 statName=pickRandomName(prayerNames);
  415.             } else if(text.contains("mag")) {
  416.                 whichSkill = STAT_MAGIC;
  417.                 statName=pickRandomName(magicNames);
  418.             } else if(text.contains("cook")) {
  419.                 whichSkill = STAT_COOKING;
  420.                 statName=pickRandomName(cookingNames);
  421.             } else if(text.contains("wc") || text.contains("woodcut")) {
  422.                 whichSkill = STAT_WOODCUTTING;
  423.                 statName=pickRandomName(woodcuttingNames);
  424.             } else if(text.contains("fletch")) {
  425.                 whichSkill = STAT_FLETCHING;
  426.                 statName=pickRandomName(fletchingNames);
  427.             } else if(text.contains("fish")) {
  428.                 whichSkill = STAT_FISHING;
  429.                 statName=pickRandomName(fishingNames);
  430.             } else if(text.contains("fm") || text.contains("fire")) {
  431.                 whichSkill = STAT_FIREMAKING;
  432.                 statName=pickRandomName(firemakingNames);
  433.             } else if(text.contains("craft")) {
  434.                 whichSkill = STAT_CRAFTING;
  435.                 statName=pickRandomName(craftingNames);
  436.             } else if(text.contains("smith")) {
  437.                 whichSkill = STAT_SMITHING;
  438.                 statName=pickRandomName(smithingNames);
  439.             } else if(text.contains("mining") || text.contains("mine")) {
  440.                 whichSkill = STAT_MINING;
  441.                 statName=pickRandomName(miningNames);
  442.             } else if(text.contains("herb")) {
  443.                 whichSkill = STAT_HERBLORE;
  444.                 statName=pickRandomName(herbloreNames);
  445.             } else if(text.contains("agil")) {
  446.                 whichSkill = STAT_AGILITY;
  447.                 statName=pickRandomName(agilityNames);
  448.             } else if(text.contains("thiev") || text.contains("theiv")) {
  449.                 whichSkill = STAT_THIEVING;
  450.                 statName=pickRandomName(thievingNames);
  451.             } else if(text.contains("slay")) {
  452.                 whichSkill = STAT_SLAYER;
  453.                 statName=pickRandomName(slayerNames);
  454.             } else if(text.contains("farm")) {
  455.                 whichSkill = STAT_FARMING;
  456.                 statName=pickRandomName(farmingNames);
  457.             } else if(text.contains("runecraft") || text.contains("rc")) {
  458.                 whichSkill = STAT_RUNECRAFTING;
  459.                 statName=pickRandomName(runecraftingNames);
  460.             } else if(text.contains("hunt")) {
  461.                 whichSkill = STAT_HUNTER;
  462.                 statName=pickRandomName(hunterNames);
  463.             } else if(text.contains("construct")) {
  464.                 whichSkill = STAT_CONSTRUCTION;
  465.                 statName=pickRandomName(constructionNames);
  466.             } else if(text.contains("summon")) {
  467.                 whichSkill = STAT_SUMMONING;
  468.                 statName=pickRandomName(summoningNames);
  469.             } else {
  470.                 statName = "NO STAT!";
  471.             }
  472.  
  473.  
  474.             if(whichSkill != -1) {
  475.                 oldTab=getCurrentTab();
  476.             openTab(TAB_STATS);
  477.                 int gambleInt = random(1,4);
  478.                 String[] extraArray = {"","","","","","","","","","","","","","","","","","",
  479.                                        "","","","","","","","","","","","","","","","","","",
  480.                                        "","","","","","","","","","","","","","","","","","",
  481.                                        "","","","","","","","","","","","","","","","","","",
  482.                                        ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  483.                                        ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  484.                                        ".",".",".",".",".",".",".",".",".",".",".",".",".",".",
  485.                                        ". =\\", ".=\\", " =\\", "=\\", ". =O", ".=O", " =O", "=O",
  486.                                        ". =)", ".=)", " =)", "=)", ". =]", ".=]", " =]", "=]",
  487.                                        ". =P", ".=P", " =P", "=P", ". =D", ".=D", " =D", "=D",
  488.                                        };
  489.                 String extra=extraArray[random(0,extraArray.length)];
  490.                 if(extra.contains("=") && random(1,3) == 1)
  491.                 extra=extra.replaceAll("=", ":"); //transforms some happyfaces :D =D
  492.                 String[] onlyArray = {"only", "just"};
  493.                 String[] levelArray = {"Lvl", "LVL", "lvl", "Lev", "lev", "LV", "lv", "Lv", "Level", "level"};
  494.                 String[] haveArray = {"have","have","have","have", "got", "Have", "Got"};
  495.                 String misc="";
  496.                 String only="";
  497.                 String have=haveArray[random(0,haveArray.length)];
  498.                 if(random(0,2) == 1 && statName.endsWith("ing")) {
  499.                     statName = statName.substring(0,statName.length()-1); //will sometimes remove g at end (e.g mining to minin)
  500.                 }
  501.                 int skillLevel = skills.getCurrentSkillLevel(whichSkill);
  502.                 if(skillLevel < 30 && random(1,5) == 3) {
  503.                     only=onlyArray[random(0,1)]+" ";
  504.                 }
  505.                     misc+=levelArray[random(0,levelArray.length)];
  506.                     if(misc.length() > 0)
  507.                         misc = " "+misc;
  508.                 if(gambleInt == 1) {
  509.                     reply=""+skillLevel+extra;
  510.                 } else if(gambleInt == 2) {
  511.                     reply="My "+statName+misc+" is "+only+skillLevel+extra;
  512.                 } else if(gambleInt == 3) {
  513.                     reply="I "+only+"have "+skillLevel+" "+statName+extra;
  514.                 }
  515.             }
  516.         }
  517.         if(reply=="NO REPLY") {
  518.             return false;
  519.         } else {
  520.                 String prefix="";
  521.             wait(random(2000,3000));
  522.             if(random(1,6) == 2)
  523.                 reply=reply.toLowerCase();
  524.             sendText(reply,true);
  525.                 if(oldTab != -1) {
  526.                     wait(random(10,100));
  527.                     openTab(oldTab);
  528.                 }
  529.             return true;
  530.         }
  531.     }
  532.     public String getScriptCategory() {
  533.         return "Antiban";
  534.     }
  535.     public int getNearestPlayerDistance() {
  536.         int Dist = 20;
  537.         RSPlayer closest = null;
  538.         int[] validPlayers = Bot.getClient().getPlayerIndexArray();
  539.         Player[] players = Bot.getClient().getPlayerArray();
  540.  
  541.         for (int element : validPlayers) {
  542.             if (players[element] == null) {
  543.                 continue;
  544.             }
  545.             RSPlayer player = new RSPlayer(players[element]);
  546.             try {
  547.                 int distance = distanceTo(player);
  548.                 if (distance < Dist) {
  549.                     Dist = distance;
  550.                     closest = player;
  551.                 }
  552.             } catch (Exception e) {}
  553.         }
  554.                 if(closest==null)
  555.                     return 999;
  556.         return distanceTo(closest.getLocation());
  557.     }
  558. }