1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. The forum has been upgraded to a more recent and user-friendly software, called "XenForo".
    It will take some time to get everything set up and running smoothly, so please report any bug you may find to the forum staff.
    Thank you for your patience.

[GM] Refresh when Timed Out

Discussion in 'Code Snippets and Tutorials' started by Rider, Aug 7, 2009.

  1. Rider

    Rider New Member

    Joined:
    Jun 25, 2008
    Messages:
    941
    Likes Received:
    72
    Location:
    Canada =D
    So when i use one of the GM Scripts, it constantly keeps timing out.
    So im just wondering how i would make it refresh when it says "This Connection has Timed Out"?
     
  2. Zer0

    Zer0 New Member

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    Code (Text):
    1. if( document.documentElement.innerHTML.indexOf( 'This Connection has Timed Out' ) != -1 )
    2.         window.location.reload();
    3.  
     
  3. Rider

    Rider New Member

    Joined:
    Jun 25, 2008
    Messages:
    941
    Likes Received:
    72
    Location:
    Canada =D
    Doesn't work :

    Code (Text):
    1. // ==UserScript==
    2. // @name           Neopets - Cliffhanger Autoplayer
    3. // @namespace      Neopets
    4. // @description    Autoplays Cliffhanger
    5. // @include        http://www.neopets.com/games/cliffhanger/*
    6. // ==/UserScript==
    7.  
    8. // this is a modified version of the script located at http://userscripts.org/scripts/show/6969
    9.  
    10. try {
    11. // select the area whith the  blanks
    12. blanksArea=document.evaluate("//tbody/tr/td[@bgcolor='skyblue']", document,
    13.         null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
    14. if (blanksArea==null) {
    15.     form = document.evaluate("//form[@action='process_cliffhanger.phtml']", document,
    16.         null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
    17.     if (form!=null) {
    18.         form.elements[1].value=3;
    19.         form.elements[4].click();
    20.     }
    21.     return;
    22. }
    23.  
    24. // read the blanks area
    25. var puzzle = ''+blanksArea.innerHTML;
    26. puzzle = puzzle.replace(/<b>/g, '');
    27. puzzle = puzzle.replace(/<\/b>/g, '');
    28. puzzle = puzzle.replace(/ /g, '');
    29. puzzle = puzzle.replace(/<fontcolor="red">/g, '');
    30. puzzle = puzzle.replace(/<\/font>/g, '');
    31. puzzle = puzzle.replace(/&nbsp;/g, ' ');
    32. puzzle = puzzle.replace(/<br>/g, ' ');
    33. puzzle = puzzle.replace(/^ */, '');
    34. puzzle = puzzle.replace(/ *$/, '');
    35. // alert("'"+puzzle.replace(/_/g, '?')+"'");
    36.  
    37. // initialize array with known answers
    38. var answer = new Array();
    39. answer[0] = 'Happy gadgadsbogen day'
    40. answer[1] = 'Better late than never';
    41. answer[2] = 'Meercas despise red neggs';
    42. answer[3] = 'No news is impossible';
    43. answer[4] = 'Scorchios like hot places';
    44. answer[5] = 'Super Glue is forever';
    45. answer[6] = 'All roads lead to neopia';
    46. answer[7] = 'Dr Frank Sloth is green';
    47. answer[8] = 'Dung furniture stinks like dung';
    48. answer[9] = 'Keep your broken toys clean';
    49. answer[10] = 'Koi invented the robotic fish';
    50. answer[11] = 'Nimmos are very spiritual beings';
    51. answer[12] = 'Today is your lucky day';
    52. answer[13] = 'A buzz will never sting you';
    53. answer[14] = 'Be nice to Shoyrus or else';
    54. answer[15] = 'Carrots are so expensive these days';
    55. answer[16] = 'Chia bombers are mud slinging fools';
    56. answer[17] = 'chombies are shy and eat plants';
    57. answer[18] = 'Faeries are quite fond of reading';
    58. answer[19] = 'Flotsams are no longer limited edition';
    59. answer[20] = 'Fuzios wear the coolest red shoes';
    60. answer[21] = 'Garon loves an endless challenging maze';
    61. answer[22] = 'Great neopets are not always wise';
    62. answer[23] = 'Kacheekers is a two player game';
    63. answer[24] = 'Korbats are creatures of the night';
    64. answer[25] = 'Moogi is a true poogle racer';
    65. answer[26] = 'Mr black makes the best shopkeeper';
    66. answer[27] = 'Number six is on the run';
    67. answer[28] = 'Only real card sharks play cheat';
    68. answer[29] = 'Skeiths are strong but very lazy';
    69. answer[30] = 'The beader has a beaming smile';
    70. answer[31] = 'The techo is a tree acrobat';
    71. answer[32] = 'Tyrannians will eat everything and anything';
    72. answer[33] = 'An air of mystery surrounds the acara';
    73. answer[34] = 'Asparagus is the food of the gods';
    74. answer[35] = 'Chombies hate fungus balls with a passion';
    75. answer[36] = 'Faerie food is food from the heavens';
    76. answer[37] = 'Frolic in the snow of happy valley';
    77. answer[38] = 'Jubjubs defend themselves with their deafening screech';
    78. answer[39] = 'Kauvara mixes up potions like no other';
    79. answer[40] = 'Kyrii take special pride in their fur';
    80. answer[41] = 'Mister pickles has a terrible tigersquash habit';
    81. answer[42] = 'Maybe the missing link is really missing';
    82. answer[43] = 'Most Wild Kikos Swim in Kiko Lake';
    83. answer[44] = 'Neopian inflation is a fact of life';
    84. answer[45] = 'Never underestimate the power of streaky bacon';
    85. answer[46] = 'Poogles look the best in frozen collars';
    86. answer[47] = 'Some neggs will bring you big disappointment';
    87. answer[48] = 'Some neggs will bring you big neopoints';
    88. answer[49] = 'The Cybunny is the fastest neopet ever';
    89. answer[50] = 'The pen is mightier than the pencil';
    90. answer[51] = 'The Snowager sleeps most of its life';
    91. answer[52] = 'Tornado rings and cement mixers are unstoppable';
    92. answer[53] = 'Uggaroo gets tricky with his coconut shells';
    93. answer[54] = 'Unis just love looking at their reflection';
    94. answer[55] = 'When there is smoke there is pollution';
    95. answer[56] = 'You cannot teach an old grarrl mathematics';
    96. answer[57] = 'A miss is as good as a mister';
    97. answer[58] = 'A neopoint saved is a neopoint not enough';
    98. answer[59] = 'A tuskaninny named colin lives on terror mountain';
    99. answer[60] = 'An iron rod bends while it is hot';
    100. answer[61] = 'Children should not be seen spanked or grounded';
    101. answer[62] = 'Doctor Sloth tried to mutate neopets but failed';
    102. answer[63] = 'Do not bathe if there is no water';
    103. answer[64] = 'Dr Death is the keeper of disowned neopets';
    104. answer[65] = 'Faerie pancakes go great with crazy crisp tacos';
    105. answer[66] = 'Flame the Tame is a ferocious feline fireball';
    106. answer[67] = 'Have you trained your pet for the Battledome';
    107. answer[68] = 'If your hedge needs trimming call a chomby';
    108. answer[69] = 'Kacheeks have mastered the art of picking flowers';
    109. answer[70] = 'Keep your pet company with a neopet pet';
    110. answer[71] = 'Kikoughela is a fancy word for cough medicine';
    111. answer[72] = 'Kougras are said to bring very good luck';
    112. answer[73] = 'Pet rocks make the most playful of petpets';
    113. answer[74] = 'Scratch my back and I will scratch yours';
    114. answer[75] = 'Snowbeasts love to attack grundos with mud snowballs';
    115. answer[76] = 'The advent calendar is only open in december';
    116. answer[77] = 'The Alien Aisha Vending Machine serves great good';
    117. answer[78] = 'The big spender is an international jet setter';
    118. answer[79] = 'The Bruce is from Snowy Valley High School';
    119. answer[80] = 'The healing springs mends your wounds after battle';
    120. answer[81] = 'The hidden tower is for big spenders only';
    121. answer[82] = 'The library faerie tends to the crossword puzzle';
    122. answer[83] = 'The tatsu population was almost reduced to extinction';
    123. answer[84] = 'You should try to raise your hit points';
    124. answer[85] = 'Whack a beast and win some major points';
    125. answer[86] = 'An idle mind is the best way to relax';
    126. answer[87] = 'Congratulations to everybody who helped defeat the evil monoceraptor';
    127. answer[88] = 'Do not open a shop if you cannot smile';
    128. answer[89] = 'Do not try to talk to a shy peophin';
    129. answer[90] = 'Enter the lair of the beast if you dare';
    130. answer[91] = 'Every neopet should have a job and a corndog';
    131. answer[92] = 'Get three times the taste with the triple dog';
    132. answer[93] = 'It is always better to give than to receive';
    133. answer[94] = 'Let every zafara take care of its own tail';
    134. answer[95] = 'Look out for the moehog transmogrification potion lurking around';
    135. answer[96] = 'Magical ice weapons are from the ice cave walls';
    136. answer[97] = 'Meercas are to blame for all the stolen fuzzles';
    137. answer[98] = 'Mika and Carassa Want You To Buy Their Junk';
    138. answer[99] = 'Neopets battledome is not for the weak or sensitive';
    139. answer[100] = 'Plesio is the captain of the tyrannian sea division';
    140. answer[101] = 'Put all of your neopoints on poogle number two';
    141. answer[102] = 'Poogle five is very chubby but is lightning quick';
    142. answer[103] = 'Poogles have extremely sharp teeth and they are cuddly';
    143. answer[104] = 'Stego is a baby stegosaurus that all neopets love';
    144. answer[105] = 'Sticks n stones are like the greatest band ever';
    145. answer[106] = 'Take your pet to tyrammet for a fabulous time';
    146. answer[107] = 'Terror Mountain is home to the infamous Ski Lodge';
    147. answer[108] = 'The barking of Lupes does not hurt the clouds';
    148. answer[109] = 'The battledome is near but the way is icy';
    149. answer[110] = 'The meat of a sporkle is bitter and inedible';
    150. answer[111] = 'The quick brown fox jumps over the lazy dog';
    151. answer[112] = 'The tyrannian volcano is the hottest place in neopia';
    152. answer[113] = 'There is only one Ryshu and one Techo Master';
    153. answer[114] = 'Treat your usul well and it will be useful';
    154. answer[115] = 'Uggaroo follows footsteps to find food for his family';
    155. answer[116] = 'Your pet deserves a nice stay at the neolodge';
    156. //answer[117] = 'There Is Nothing Like A Tall Glass Of Slime Potion';
    157. answer[117] = ''; //was a duplicate!
    158. answer[118] = 'A chia who is a mocker dances without a tamborine';
    159. answer[119] = 'All neopets can find a job at the employment agency';
    160. answer[120] = 'Become a BattleDome master by training on the Mystery Island';
    161. answer[121] = 'Better to be safe than meet up with a monocerous';
    162. answer[122] = 'Bouncing around on its tail the blumaroo is quite happy';
    163. answer[123] = 'Chias are loveable little characters who are full of joy';
    164. answer[124] = 'Faeries bend down their wings to a seeker of knowledge';
    165. answer[125] = 'Grarrg is the tyrannian battle master that takes no slack';
    166. answer[126] = 'If you live with lupes you will learn to howl';
    167. answer[127] = 'Kyruggi is the grand elder in the tyrannian town hall';
    168. answer[128] = 'Love your neopet but do not hug it too much';
    169. answer[129] = 'Meercas are talented pranksters that take pride in their tails';
    170. answer[130] = 'Oh where is the tooth faerie when you need her';
    171. answer[131] = 'Only ask of the Queen Faerie what you really need';
    172. answer[132] = 'Please wipe your feet before you enter the Scorchio den';
    173. answer[133] = 'Some neohomes are made with mud and dung and straw';
    174. answer[134] = 'Store all of your Neopian trading cards in your neodeck';
    175. answer[135] = 'The best thing to spend on your neopet is time';
    176. answer[136] = 'The kindhearted faerie queen rules faerieland with a big smile';
    177. answer[137] = 'The lair of the beast is cold and dark inside';
    178. answer[138] = 'The meerca is super fast making it difficult to catch';
    179. answer[139] = 'The pound is not the place to keep streaky bacon';
    180. answer[140] = 'There is nothing like a tall glass of slime potion';
    181. answer[141] = 'The sunken city of Maraqua has some great hidden treasures';
    182. answer[142] = 'The tyrannian jungle is full of thick muddle and mash';
    183. answer[143] = 'The wise aisha has long ears and a short tongue';
    184. answer[144] = 'To know and to act are one and the same';
    185. answer[145] = 'Under a tattered cloak you will generally find doctor sloth';
    186. answer[146] = 'With the right training Tuskaninnies can become quite fearsome fighters';
    187. answer[147] = 'Yes boy ice cream sell out all of their shows';
    188. answer[148] = 'A journey of a million miles begins on the marketplace map';
    189. answer[149] = 'Ask a lot of questions but only take what is offered';
    190. answer[150] = 'Be sure to visit the Neggery for some great magical neggs';
    191. answer[151] = 'Bruce could talk under wet cement with a mouthful of marbles';
    192. answer[152] = 'By all means trust in neopia but tie your camel first';
    193. answer[153] = 'Count Von Roo is one of the nastier denizens of neopia';
    194. answer[154] = 'Do not wake the snowager unless you want to be eaten';
    195. answer[155] = 'Every buzz is a kau in the eyes of its mother';
    196. answer[156] = 'Faerie poachers hang out in faerieland with their jars wide open';
    197. answer[157] = 'Give the wheel of excitement a spin or two or three';
    198. answer[158] = 'Grarrls are ferocious creatures or at least they try to be';
    199. answer[159] = 'Have you told your friends about the greatest site on earth';
    200. answer[160] = 'If a pteri and lenny were to race neither would win';
    201. answer[161] = 'Jetsams are the meanest Neopets to ever swim the Neopian sea';
    202. answer[162] = 'Kaus love to sing although they only know a single note';
    203. answer[163] = 'Listen to your pet or your tongue will keep you deaf';
    204. answer[164] = 'Make certain your pet is well equipped before entering the battledome';
    205. answer[165] = 'Only mad gelerts and englishmen go out in the noonday sun';
    206. answer[166] = 'Poogle number five always wins unless he trips over a hurdle';
    207. answer[167] = 'Space slushies are just the thing on a cold winter day';
    208. answer[168] = 'The bluna was first sighted under the ice caps of tyrannia';
    209. answer[169] = 'The Neopedia is a good place to start your Neopian Adventures';
    210. answer[170] = 'Tyrannia is the prehistoric kingdom miles beneath the surface of neopia';
    211. answer[171] = 'When eating a radioactive negg remember the pet who planted it';
    212. answer[172] = 'When friends ask about the battledome say there is no tomorrow';
    213. answer[173] = 'When the blind lead the blind get out of the way';
    214. answer[174] = 'You cannot wake a Bruce who is pretending to be asleep';
    215. answer[175] = 'You know the soup kitchen is a great place to go';
    216. answer[176] = 'You know you can create a free homepage for your pet';
    217. answer[177] = 'You probably do not want to know what that odor is';
    218. answer[178] = 'A kyrii will get very upset if its hair gets messed up';
    219. answer[179] = 'By all means make neofriends with peophins but learn to swim first';
    220. answer[180] = 'Catch the halter rope and it will lead you to the kau';
    221. answer[181] = 'Cliffhanger is a brilliant game that will make your pet more intelligent';
    222. answer[182] = 'Dirty snow is the best way to make your battledome opponent mad';
    223. answer[183] = 'Do not be in a hurry to tie what you cannot untie';
    224. answer[184] = 'Do not speak of an elephante if there is no tree nearby';
    225. answer[185] = 'Do not think there are no jetsams if the water is calm';
    226. answer[186] = 'Eat all day at the giant omelette but do not be greedy';
    227. answer[187] = 'Everyone loves to drink a hot cup of borovan now and then';
    228. answer[188] = 'Experience is the comb that nature gives us when we are bald';
    229. answer[189] = 'Fly around the canyons of tyrannia shooting the evil pterodactyls and grarrls';
    230. answer[190] = 'If you see a man riding a wooden stick ask him why';
    231. answer[191] = 'If you want to have lots of adventures then adopt a wocky';
    232. answer[192] = 'Jarbjarb likes to watch the tyrannian sunset while eating a ransaurus steak';
    233. answer[193] = 'Krawk have been known to be as strong as full grown neopets';
    234. answer[194] = 'Myncies love to hug their plushies and eat sap on a stick';
    235. answer[195] = 'Quiggles spend all day splashing around in the pool at the neolodge';
    236. answer[196] = 'The Grarrl will roar and ten eggs will hatch into baby grarrls';
    237. answer[197] = 'The Snow Faerie Quest is for those that can brave the cold';
    238. answer[198] = 'The wheel of mediocrity is officially the most second rate game around';
    239. answer[199] = 'There is only one ryshu and there is only one techo master';
    240. answer[200] = 'Uggsul invites you to play a game or two of tyranu evavu';
    241. answer[201] = 'When an Elephante is in trouble even a Nimmo will kick him';
    242. answer[202] = 'You should not throw baseballs up when the ceiling fan is on';
    243. answer[203] = 'A Scorchio is a good storyteller if it can make a Skeith listen';
    244. answer[204] = 'Bang and smash your way to the top in the bumper cars game';
    245. answer[205] = 'Do not be greedy and buy every single food item from the shops';
    246. answer[206] = 'Faerieland is not for pets that are afraid of heights or fluffy clouds';
    247. answer[207] = 'If at first you do not succeed play the ice caves puzzle again';
    248. answer[208] = 'If you go too slow try to keep your worms in a tin';
    249. answer[209] = 'If your totem is made of wax do not walk in the sun';
    250. answer[210] = 'It makes total sense to have a dung carpet in your dung neohome';
    251. answer[211] = 'Myncies come from large families and eat their dinner up in the trees';
    252. answer[212] = 'The Neopian Hospital will help get your pet on the road to recovery';
    253. answer[213] = 'We never know the worth of items till the wishing well is dry';
    254. answer[214] = 'You can lead a kau to water but you cannot make it drink';
    255. answer[215] = 'Building a neohome is a way to build a foundation for your little pets';
    256. answer[216] = 'You know you should never talk to Bruce even when his mouth is full';
    257. answer[217] = 'Your neopet will need a mint after eating a chili cheese dog with onions';
    258. answer[218] = 'Why beg for stuff when you can make money at the wheel of excitement';
    259. answer[219] = 'Bronto bites are all the rage and they are meaty and very easy to carry';
    260. answer[220] = 'The beast that lives in the tyrannian mountains welcomes all visitors with a sharp smile';
    261. answer[221] = 'The whisper of an acara can be heard farther than the roar of a wocky';
    262. answer[222] = 'You really have to be well trained if you want to own a wild reptillior';
    263.  
    264. // select possible answers from hardcoded list.
    265. var possible = new Array();
    266. var regexp=new RegExp("^"+puzzle.replace(/_/g, '\\w')+"$");
    267. regexp.ignoreCase=true;
    268.  
    269. for (var ans = 0; ans < answer.length; ans++) {
    270.     if (answer[ans].length==puzzle.length) {
    271.         if (regexp.test(answer[ans])) {
    272.             possible.push(answer[ans]);
    273.         }
    274.     }
    275. }
    276.  
    277. if (possible.length==1) {
    278.     solveinput=document.evaluate("//input[@name='solve_puzzle']", document,
    279.         null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
    280.     solvesubmit=document.evaluate("//input[@value='I Know!!! Let Me Solve The Puzzle!']", document,
    281.         null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
    282.     solveinput.value=possible[0];
    283.     solvesubmit.click();
    284. } else {
    285.     alert(possible.join('\n'));
    286. }
    287.  
    288. } catch (e) {
    289.     GM_log("np-cliffhangerautoplayer: "+e);
    290. }
    291. if( document.documentElement.innerHTML.indexOf( 'This Connection has Timed Out' ) != -1 )
    292.       window.location.reload();
     
  4. Zer0

    Zer0 New Member

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    Try putting it at the top?
    And that's weird, I've never gotten that error before
     
  5. Rider

    Rider New Member

    Joined:
    Jun 25, 2008
    Messages:
    941
    Likes Received:
    72
    Location:
    Canada =D
  6. Zer0

    Zer0 New Member

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    Oh lol, you can't control that with a GM script :p
     
  7. Rider

    Rider New Member

    Joined:
    Jun 25, 2008
    Messages:
    941
    Likes Received:
    72
    Location:
    Canada =D
    Why?
    But when i simply refresh it works again?
     
  8. Zer0

    Zer0 New Member

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    That's a special page loaded by Firefox, not your standard web page. I don't think GM executes on those pages.
     
  9. jazzeh

    jazzeh New Member

    Joined:
    Jan 1, 2008
    Messages:
    144
    Likes Received:
    15
  10. Rider

    Rider New Member

    Joined:
    Jun 25, 2008
    Messages:
    941
    Likes Received:
    72
    Location:
    Canada =D
    Alright Zer0 i adjusted the code and it works now, cept one thing.
    After it refreshes, there's this message that says :
    [​IMG]

    How can i automatically make the GM script press Resend?
     
  11. jazzeh

    jazzeh New Member

    Joined:
    Jan 1, 2008
    Messages:
    144
    Likes Received:
    15
    GM can't press resend or disable it.

    That's a security feature in firefox that can't be disabled unless you rewrite the code (there isn't a about;config entry you can easily change)

    Perhaps you can change it so that it doesn't refresh but instead goes back a page. Then the script will take back over and resend the data the regular way.
     
    Zer0 likes this.
  12. Cacklenub

    Cacklenub New Member

    Joined:
    May 10, 2008
    Messages:
    1,345
    Likes Received:
    58
    Try to do the opposite of what Zer0 did basically...don't know gm so I can't help much.

    But basically try to make it so that if the page DOESN'T contain that, then reload. I don't know if this would work or not, but maybe worth a shot.

    So if the page doesn't contain cliffhanger(i.e. it's on a dead page or a neopets error page), then it will reload or go back or something.
     

Share This Page