Page 6 of 9

Posted: Tue Jan 13, 2009 6:01 am
by Hannahmaus
It looks right except the TAG POS=2 at the start. My iMacros casts the 2 gadgeteer self-casts and MD, and has TAG POS=1 on each line, even though the MD control appears to be the 2nd element in the frame. Maybe change the 2 to a 1 and see what it does.

I guess you'll have tried re-recording the macro; maybe try re-recording it and casting the buffs in a different order (self-casts then buff).

Posted: Tue Jan 13, 2009 10:18 pm
by MagiNinjA
Hmm. This is sorta weird. Right now I have it set to cast Bio and then the others, but it just casts Bio once and casts Vim 7 times and then ends. It seems impossible to make it cast multiple auras.

I'd like to reinstate my request for a skill macro script. :/

EDIT: This is with TAG POS=1 like you did. So.

Posted: Wed Jan 14, 2009 12:43 pm
by Hannahmaus
The casting only 1 of 1 of the buffs makes me think it's confused about which input box is which and putting the number in the wrong 1, and the non-casting of the 2 others is... mysterious. If you record a macro with only 1 cast of each buff, does it work? Just a thought.

Re: Greasemonkey

Posted: Sat Jul 25, 2009 3:43 pm
by Muhandes
Someone suggested it add chat, so I tried to write a script that adds a link to the MD in the top pane. I totally stole the Rest link script. But still, the problem is, it includes user ID and I can't find a way to get that from the top pane, and I don't know enough to get it from another pane.
Anyway, if you don't mind kludging around here it is, just change the ID to your ID.

Edit: I created a script that solves this problem. See here

Code: Select all

// ==UserScript==
// @name	MD Link
// @namespace	http://www.twilightheroes.com/forums/
// @description	Adds a link to MD after the link to Full Inventory.
// @include	*twilightheroes.com/header.php
// ==/UserScript==

for (var i = 0; i < document.getElementsByTagName('a').length; i++) {
	if (document.getElementsByTagName('a')[i].href.indexOf("inventory.php") != -1) {
		var inventoryLink = document.getElementsByTagName('a')[i];
	}
}

var addLinks = document.createElement('a');
addLinks.href = "memento-show.php?charid=14240";
addLinks.style.color = "#CCCCCC";
addLinks.target = "main";
addLinks.innerHTML = "MD";

var spacer = document.createTextNode(' - ');

inventoryLink .parentNode.insertBefore(addLinks, inventoryLink .nextSibling);
inventoryLink .parentNode.insertBefore(spacer, inventoryLink.nextSibling);

Re: Greasemonkey

Posted: Tue Jul 28, 2009 11:40 pm
by MagiNinjA
Not sure if ClownHammer and Co. is still around, but, if there was a way to have monster specific actions, that'd be great. So like if I met a gangster in red, maybe I'd use a spell instead. And if I can't, then just attack or something. I primarily want it so I can use items on specific monsters.

Re: Greasemonkey

Posted: Wed Aug 05, 2009 7:06 am
by Muhandes
Is there anyone around here that can still help writing scripts? There are some simple things I would like to add to Continuous Attack which will make it a valuable spading tool.
For instance, I noticed it already differentiates between combat and non-combat adventures, so just keeping tag of how many times each was encountered would be very helpful.

Re: Greasemonkey

Posted: Sat Aug 08, 2009 6:34 pm
by Satan
He wants to know how many of each encounter (combat or not) he gets. Like, each enemy/non-com shows up and says encountered x times. For percentage stuffs.

Re: Greasemonkey

Posted: Sun Aug 09, 2009 12:42 am
by Muhandes
Of course, I want EVERYTHING. But starting from simple to more complicated, each step would be useful on its own.

1. A simple counter of combat/non-combat. I looked at the code and this is already detected and there are empty if clauses where I could increment the counters. But since I have zero experience in javascript I don't know how to display these counters. I don't mind any reasonable solution for where/how they are displayed and where/how to reset them.
2. Find the exact adventure and displaying counters how many times each occur. For non-combats this shouldn't be too hard as the adventure name can serve as key. For combats everything after "You are fighting" can serve as key.
3. For each adventure, displaying item and chip drop statistics. This will probably require much more work parsing the drops.

As mentioned above, even step 1, which I could implement if I knew how to display things, would start the usefulness of this as a spading tool.

Re: Greasemonkey

Posted: Sun Aug 09, 2009 1:07 am
by Satan
This would be much more easily done in a bot like in perl or php... JS kinda sucks... But overall the methods aren't that dissimilar in any of the languages, you've just got language limitations to deal with in JS. Technically, with a few modifications, the phpbot can already do what you want it to do. But the phpbot's got several bugs in it, so >.>

Re: Greasemonkey

Posted: Sun Aug 09, 2009 5:15 am
by Muhandes
Satan wrote:This would be much more easily done in a bot like in perl or php... JS kinda sucks... But overall the methods aren't that dissimilar in any of the languages, you've just got language limitations to deal with in JS. Technically, with a few modifications, the phpbot can already do what you want it to do. But the phpbot's got several bugs in it, so >.>
One problem is that the phpbot is non-interactive. In many cases I see a problem in the spade run very early and I can stop it before 300 turns are wasted. At the current turn/day this is an issue. Perhaps it can be made more verbose and more interactive?
Then there is the issue of the bugs you mentioned.
I am also a bit worried about sending my password, though this might be just lack of knowledge of how it is done.

Bottom line, I don't really mind if the tool is JS or phpbot, as long as it does what is required.

Edit: After posting this I realized one other problem. The code for phpbot isn't open. Would you be willing to reveal it?

Re: Greasemonkey

Posted: Sun Aug 09, 2009 5:12 pm
by Satan
Muhandes wrote:
Satan wrote:This would be much more easily done in a bot like in perl or php... JS kinda sucks... But overall the methods aren't that dissimilar in any of the languages, you've just got language limitations to deal with in JS. Technically, with a few modifications, the phpbot can already do what you want it to do. But the phpbot's got several bugs in it, so >.>
One problem is that the phpbot is non-interactive. In many cases I see a problem in the spade run very early and I can stop it before 300 turns are wasted. At the current turn/day this is an issue. Perhaps it can be made more verbose and more interactive?
Then there is the issue of the bugs you mentioned.
I am also a bit worried about sending my password, though this might be just lack of knowledge of how it is done.

Bottom line, I don't really mind if the tool is JS or phpbot, as long as it does what is required.

Edit: After posting this I realized one other problem. The code for phpbot isn't open. Would you be willing to reveal it?
You don't need to worry about sending the password. The password isn't stored, it's forwarded directly from my server to Ryme's for login, so no one sees it. As for making the phpbot code open, can't do that. It has code for IP tracking measures and the quest stuff, which is part of my agreement with Ryme to have it available for other players. If it was open, other people could just host it themselves and remove those parts rather easily.

Re: Greasemonkey

Posted: Mon Aug 10, 2009 9:36 am
by neocamp22
Counting how many times you get each adventure and how many time you get each item is very similar codewise. However, I don't think anyone has even begun doing either of those two things for phpbot. I might be willing to take a look this week. Sate, please send me the code when you've got a sec.

Combat and non-combat is much easier to do, and I think I could easily add it in if I can get a copy of the current code from Sate (actually, he could probably do it in the time it would take him to send the code to me and then take my code and update the site).

Re: Greasemonkey

Posted: Mon Aug 10, 2009 5:53 pm
by Satan
When we renovated Olaf's phpbot code, I added in item tracking. Although I should probably make a separate array for tracking by encounter. Probably can do that via the array we'd have to make for tracking encounters, so no big deal, either. I'll send the code as soon as I remember your email address >.>

Re: Greasemonkey

Posted: Fri Sep 04, 2009 4:11 pm
by Harry Dresden
Anyone know how to edit the autoattack script so that it can throw a star before attacking to death?

Re: Greasemonkey

Posted: Fri Sep 04, 2009 7:49 pm
by MagiNinjA
My request would fulfill yours, for sure.

Re: Greasemonkey

Posted: Thu Sep 24, 2009 9:14 pm
by Cristiona
I have a working copy. Possibly messy as hell, but here you go:

Code: Select all

// ==UserScript==
// @name           Twilight Heros Adventure Script
// @namespace      www.twilightheroes.com
// @description    Autoadventureing for TH. 
// @include        http://www.twilightheroes.com/fight.php*
// ==/UserScript==

function Select_Value_Set(SelectName, Value) {
  var SelectObject = document.getElementById(SelectName);
  for(index = 0; 
    index < SelectObject.length; 
    index++) {
   if(SelectObject[index].value == Value)
     SelectObject.selectedIndex = index;
   }
}

function Select_Value_Set_Name(SelectName,which, Value) {
  var SelectObject = document.getElementsByName(SelectName)[which];
  var found = false;
  for(index = 0; 
    index < SelectObject.length; 
    index++) {
   if(SelectObject[index].value == Value)
     SelectObject.selectedIndex = index;
     found = true;
   }
   return found;
}

function generateStratList () {
	var stratList = new Array();
	//List of attack types, any string Specification string. Each attack is seperated by a semicolon and if there is a skill use the id follows the S. 
	//A = normal attack
	//S:ID = use a skill with the appropriate ID following the colon
	//IS:ID = perform the attack a specific number of times and then just use attack. Right now IS must be the only option if its being used so you can't 
	// 	put something like 'IS:152;A;IS:133' since you wouldn't know which IS block 
	stratList['TK To Death'] = 'S:153';
	stratList['Attack then TK To Death'] = 'A;S:153';
	stratList['MJ to Death'] = 'S:156';
	stratList['PB, Mj to Death'] = 'S:163;S:156';
	stratList['Telek for '] = 'IS:153';
	stratList['MindJab for '] = 'IS:156';
	stratList['Psionic Blast for '] = 'IS:163';
	stratList['Stun Gas for '] = 'IS:101';
	stratList['Bovine Charge for '] = 'IS:52';
	stratList['Electric Net for '] = 'IS:109';
	stratList['Firestorm for '] = 'IS:12';
	stratList['Groundquake for '] = 'IS:4';
	stratList['Ice Bolt for '] = 'IS:3';
	stratList['Lightning Bolt for '] = 'IS:6';
	stratList['Shock Grenade for '] = 'IS:113';
	stratList['Throw Sparks for '] = 'IS:1';
	stratList['Tornadoe for '] = 'IS:9';
	stratList['Rhino Trample for '] = 'IS:60';
	
	var htmlStrat = '\n<SELECT id="Strat" onchange="updateAttackControls();">';
	htmlStrat += '<OPTION VALUE="A">Attack Only</OPTION>';
	for (keys in stratList) {
		htmlStrat += '<OPTION VALUE="'+stratList[keys]+'">'+keys+'</OPTION>';
	}
	
	htmlStrat += '</SELECT>';
	htmlStrat += '\n<script>function updateAttackControls() {					'+
		'\nvar strat = document.getElementById(\'Strat\');			'+
		'\nvar actionstuff = strat[strat.selectedIndex].value.split(\';\');	'+
		'\nvar possible = actionstuff[0].split(\':\');			'+
		'\nif (possible[0] == \'IS\') {					'+
		'\n	document.getElementById(\'control\').innerHTML = \'<input type="text" maxlength="5" size="2" id="maxAttacks"> rounds then attack.\';	'+
		'\n	} else {							'+
		'\n	document.getElementById(\'control\').innerHTML = \'\';	'+
		'\n	}								'+
		'\n} '+
		'</script>								'+
			'';
	return htmlStrat;
}

function updateAttackControls() {					
	var strat = document.getElementById('Strat');			
	var actionstuff = strat[strat.selectedIndex].value.split(';');	
	var possible = actionstuff[0].split(':');			
	if (possible[0] == 'IS') {
		var currentRound = (GM_getValue('roundNumber',0) < 0? 0:GM_getValue('roundNumber',0));
		var attacksLeft = GM_getValue('maxAttacks',0) - (currentRound);
		attacksLeft = (attacksLeft < 0?0:attacksLeft);
		document.getElementById('control').innerHTML = '<input type="text" maxlength="5" size="2" id="maxAttacks" '+(GM_getValue('maxAttacks',0)!=0?'value="'+GM_getValue('maxAttacks',0)+'"':'value="0"')+'> rounds then attack.'+
								' <br> rounds for skill use left : '+attacksLeft;	
	} else {							
		document.getElementById('control').innerHTML = '';	
	}								
}
function stepToNextRound() {
	//we havent won and we are still running
	var nonComName = getNonCombatName();
	GM_log(' in the step to Next round the noncom name is '+nonComName);
	var nextButton = getNextButton(nonComName);
	GM_log('found the button '+nextButton);
	//Save the strat to use
	var strat = document.getElementById('Strat');
	GM_setValue('selectedStrat',strat[strat.selectedIndex].value);
	GM_log('Selected Strategy is '+strat[strat.selectedIndex].value);
	nextButton.click();
}

function stepToNextCombat() {
	//window.location = 'http://www.twilightheroes.com/fight.php?location=22';
	var searchy = find('.//td[contains(.,"Patrol again")]');
	if (searchy != null) {
		var linkk = find('.//a',searchy);
		window.location = linkk;
		//GM_log(" found element "+linkk);
		//GM_log(" found element "+searchy);
		
		//Save the strat to use
		var strat = document.getElementById('Strat');
		GM_setValue('selectedStrat',strat[strat.getSelectedIndex].value);
		
	}
	
}

function endOfTurn() {
	//window.location = 'http://www.twilightheroes.com/fight.php?location=22';
	var searchy = find('.//td[contains(.,"Patrol again")]');
	if (searchy != null) {
		var linkk = find('.//a',searchy);
//GM_log('end of adventure');		

		if (linkk != null) {
//GM_log('end of adventure2');		
			return true;
		}

	}

	return false;
}

function idEncounter() {
	var combatIndicator = find('.//h1[1]');
	var nonCombatIndicator = find('.//h2[1]');
	
	var type = null;
	if (combatIndicator != null) {
		GM_log(" found type combat "+combatIndicator.innerHTML);
		if ('Combat!' == combatIndicator.innerHTML) {
			type = 'combat'
		}
	}
	if (nonCombatIndicator != null) { 
		if (endOfTurn()) {
			GM_log(" found type non-combat "+nonCombatIndicator.innerHTML);
			type='non-combat';
		} else {
			GM_log(" found type choice-non-combat "+nonCombatIndicator.innerHTML);
			type='choice-non-combat';
		}
	}
	return type;
}

function getNonCombatName() {
	
	var nonCombatIndicator = find('.//h2[1]');
	
	var nonname;
	if (nonCombatIndicator != null) { 
		
		nonname = nonCombatIndicator.innerHTML;
	}
	GM_log(" found type choice-non-combat "+nonname);
	return nonname;
}	

function getNextButton(nonCombatName) {
GM_log('Non combat name '+nonCombatName);
var nonComChoice = new Array();

//Config the choice combats
//
//nonComChoice["Crime Never Sleeps ... or Does It?"+"choice"] = "1"; //Pick up Litter
//nonComChoice["Crime Never Sleeps ... or Does It?"+"choice"] = "2"; //Catch up with friend
nonComChoice["Crime Never Sleeps ... or Does It?"+"choice"] = "3"; //Keep Walking

nonComChoice["Crime Never Sleeps ... or Does It?"+"submitvalue"] = "Make your choice"; //Pick up Litter

nonComChoice["Pick Yer Poison"+"choice"] = "1"; //caffeine
//nonComChoice["Pick Yer Poison"+"choice"] = "2"; //PP
//nonComChoice["Pick Yer Poison"+"choice"] = "3"; //SFA

nonComChoice["Pick Yer Poison"+"submitvalue"] = "What do you do?";

//nonComChoice["Gotta Move Quick"+"choice"] = "3"; //???
nonComChoice["Gotta Move Quick"+"choice"] = "4"; //backpack
//nonComChoice["Gotta Move Quick"+"choice"] = "5"; //unlock rooftops/nothing?

nonComChoice["Gotta Move Quick"+"submitvalue"] = "Think Fast!"

nonComChoice["Glove Slap, Baby"+"choice"] = "1"; //fight knight
//nonComChoice["Glove Slap, Baby"+"choice"] = "2"; //work the rep
//nonComChoice["Glove Slap, Baby"+"choice"] = "3"; //KFC

nonComChoice["Glove Slap, Baby"+"submitvalue"] = "What do you do?"; //

nonComChoice["A Dilemma of the Horns"+"choice"] = "6"; // money/rep
//nonComChoice["A Dilemma of the Horns"+"choice"] = "7"; //item
//nonComChoice["A Dilemma of the Horns"+"choice"] = "8"; //squat

nonComChoice["A Dilemma of the Horns"+"submitvalue"] = "What do you do?"; //

nonComChoice["Intermission"+"choice"] = "1"; // Exit stage left
//nonComChoice["Intermission"+"choice"] = "2"; //Exit stage right
//nonComChoice["Intermission"+"choice"] = "3"; //Exit fourth wall

nonComChoice["Intermission"+"submitvalue"] = "Pick Your Exit";

///nonComChoice["Shipping Clerk"+"choice"] = "1"; // lousy caf
//nonComChoice["Shipping Clerk"+"choice"] = "2"; //money/rep
nonComChoice["Shipping Clerk"+"choice"] = "3"; //xp

nonComChoice["Shipping Clerk"+"submitvalue"] = "What do you do?";

nonComChoice["Two Paths Diverged in a Prehistoric Wood"+"choice"] = "1"; // pegasus - or fight if the option doesn't exist
//nonComChoice["Two Paths Diverged in a Prehistoric Wood"+"choice"] = "2"; //lame item
//nonComChoice["Two Paths Diverged in a Prehistoric Wood"+"choice"] = "3"; //lame item 2

nonComChoice["Two Paths Diverged in a Prehistoric Wood"+"submitvalue"] = "What do you do?";

//Castle Non combats
nonComChoice["Forgot to Mention the Crystal Skulls"+"choice"] = "5";
//nonComChoice["Forgot to Mention the Crystal Skulls"+"choice"] = "6";
//nonComChoice["Forgot to Mention the Crystal Skulls"+"choice"] = "7";
nonComChoice["Forgot to Mention the Crystal Skulls"+"submitvalue"] = "Make your choice";

//nonComChoice["Behind Door Number Three ..."+"choice"] = "1"; //Grab Nearest
//nonComChoice["Behind Door Number Three ..."+"choice"] = "2"; //Investigate
//nonComChoice["Behind Door Number Three ..."+"choice"] = "3"; //Check the experimental
nonComChoice["Behind Door Number Three ..."+"choice"] = "4"; //Forget
nonComChoice["Behind Door Number Three ..."+"submitvalue"] = "Go with the plan";

var nextButton;
if (nonCombatName != null) {
GM_log(" non combat value is "+nonComChoice[nonCombatName+"choice"]);
var radiochoice = find('.//input[@type="radio" and @name="choice" and @value="'+nonComChoice[nonCombatName+"choice"]+'"]');
var radiosetchoice = find('.//input[@type="radio" and @name="choice" and @value="4"]');
if (radiosetchoice != null) {
radiosetchoice.checked=true;}
else{
//GM_log('attempting to use this choice '+radiochoice.value);
if (radiochoice != null) {
radiochoice.checked=true;}}
nextButton=find('.//input[@type="submit" and @value="'+nonComChoice[nonCombatName+"submitvalue"]+'"]');
GM_log(" Found noncombat button "+nextButton);
} else {
//Handle combat options
var strategy = GM_getValue('selectedStrat','A').split(';');
var round = (GM_getValue('roundNumber', 0)>=strategy.length?strategy.length-1:GM_getValue('roundNumber', 0));
GM_log("round option "+strategy[round]);
var selectedAction = strategy[round].split(':');
//GM_log("round option option "+selectedAction[0]+' With option '+selectedAction[1]);
if (selectedAction[0]=='A') {
nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');}
else if (selectedAction[0]=='S') {
nextButton=find('.//input[@type="submit" and contains(@value,"Skill")]');
if (!Select_Value_Set_Name('pickwhich',0,selectedAction[1])) {
//If there is no action to select then fall back to attack
nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');} }
else if (selectedAction[0]=='IS') {
var currentRound = (GM_getValue('roundNumber',0) < 0? 0:GM_getValue('roundNumber',0));
var attacksLeft = GM_getValue('maxAttacks',0) - (currentRound);
if (attacksLeft > 0) {
nextButton=find('.//input[@type="submit" and contains(@value,"Skill")]');
if (!Select_Value_Set_Name('pickwhich',0,selectedAction[1])) {
//If there is no action to select then fall back to attack
nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');}}
else {
nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');}}
else if (selectedAction[0]=='I') {
nextButton=find('.//input[@type="submit" and contains(@value,"Item")]');
if (!Select_Value_Set_Name('pickwhich',1,selectedAction[1])) {
//If there is no action to select then fall back to attack
nextButton=find('.//input[@type="submit" and contains(@value,"Attack")]');}}}
return nextButton;}

//GM_log("encounter is "+idEncounter());
//idEncounter();
var imageTD = find('.//img[@border="3"]/..');
if (imageTD) {

	var victory = /Victory!/;
	var loss = / /;
	//GM_log(imageTD.tagName);
	var last = find('./*[last()]',imageTD);
	//GM_log(last.tagName);
	var weWon = victory.exec(document.body.innerHTML);
	
	var advTable = document.createElement("table");
	var advRow = document.createElement("tr");
	var advCell = document.createElement("td");
	var buttontype= null;
	var displayRound = null;
	
	if (endOfTurn()) {
		//clean up from a victory
		//GM_setValue('running',false);

		GM_setValue('turnsLeft',GM_getValue('turnsLeft',0)-1);

		var round = GM_getValue('roundNumber',-1)+1;
		displayRound= round;
		GM_setValue('roundNumber', -1);
		if (GM_getValue('running',false)&&(GM_getValue('turnsLeft',false) > 0)){
			//Victory and we need to patrol again, find the hyperlink and navigate to it. 
			GM_setValue('delayID',setTimeout(stepToNextCombat,30));		
		} else { 
			//at the end of the turns. 
			GM_setValue('running',false);
		}

	} else {
		//Update the round count

		var round = GM_getValue('roundNumber',-1)+1;
		//GM_log('round '+round);
		GM_setValue('roundNumber', round);		
		displayRound= GM_getValue('roundNumber', -1);		
		
	}
	
	if (GM_getValue('turnsLeft',false) <= 0) {
		GM_setValue('running',false);
	}
	
	if (GM_getValue('running',false)) {
		buttontype = '<br><input type="button" id="stop" value="Stop">';	
	} else {
		buttontype = '<br><input type="button" id="start" value="Click to Start">';
	
	}
	advCell.innerHTML= 'Battle Computer : Combat Round '+displayRound +
	'<br> <input type="text" maxlength="5" id="turns" value="'+(GM_getValue('turnsLeft',false)?GM_getValue('turnsLeft',false):'0')+
	'">'+generateStratList()+'<div id="control"></div>'+
	buttontype;
	advRow.insertBefore(advCell,null);
	advTable.insertBefore(advRow,null);
	imageTD.insertBefore(advTable,null);
	Select_Value_Set('Strat',GM_getValue('selectedStrat','A')); //Default to attack if theres no selected strat.
	updateAttackControls();
	//(weWon?weWon[0]:'');


	if (document.getElementById("start")) {
		document.getElementById("start").addEventListener("click",rockIt,true);
	}
	if (document.getElementById("stop")) {
		document.getElementById("stop").addEventListener("click",shutDown,true);
	}
	
	if ((weWon == null)&&(GM_getValue('running',false))) {
		GM_setValue('delayID',setTimeout(stepToNextRound,20));
	}
}

function find(xp,location) {
	if(!location)location = document;
	var temp = document.evaluate(xp, location, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null);
	return temp.singleNodeValue;
}

function rockIt() {
	if (document.getElementById("turns").value <=0) return false;
	GM_setValue("running", true);
	
	var strat = document.getElementById('Strat');
	GM_setValue('selectedStrat',strat[strat.selectedIndex].value);
	GM_setValue('turnsLeft',document.getElementById("turns").value);
	if (document.getElementById("maxAttacks")) {
		GM_setValue('maxAttacks',document.getElementById("maxAttacks").value);
	}
	//GM_setValue("turns_left", document.getElementById("turns").value-1); 
	//document.getElementsByName("heads")[0].click();
	var attackButton = find('.//input[@type="submit" and contains(@value,"Attack")]');
	//var attackButton = 
	if (endOfTurn()) {
		stepToNextCombat();
	}
	else if (attackButton) {
		attackButton.click();
		
	} 
}

function shutDown() {
	//if (document.getElementById("turns").value <=0) return false;
	GM_setValue("running", false);
	
	var strat = document.getElementById('Strat');
	GM_setValue('selectedStrat',strat[strat.selectedIndex].value);
	//GM_setValue("turns_left", document.getElementById("turns").value-1); 
	//document.getElementsByName("heads")[0].click();
	if (GM_getValue('delayID')) {
		clearTimeout(GM_getValue('delayID'));
	}
}		


	

Re: Greasemonkey

Posted: Fri Sep 25, 2009 2:53 am
by Muhandes
I had to turn off all other scripts to make this work, but now it does and it's very fine.

Re: Greasemonkey

Posted: Fri Sep 25, 2009 4:23 am
by Cristiona
Well... you need to turn off other combat scripts. Outfit Manager, XP Status, and SellCube Items all play nicely with it. Actually, now that I think about it, so does Stationary Combat Buttons.

Re: Greasemonkey

Posted: Sat Sep 26, 2009 11:04 am
by Muhandes
I had to turn off Stationary Combat Buttons, Choice Selection Saver, Continuous Attack, so far, as expected, but also the wikifier, which I wasn't expecting.

Re: Greasemonkey

Posted: Sat Sep 26, 2009 2:40 pm
by Carygon Nijax
how can I install those "improved" adventure scripts?

Re: Greasemonkey

Posted: Tue Sep 29, 2009 12:00 am
by Muhandes
Thanks for posting it.

Can you add the other choice adventures please? I noticed specifically that "Just Deserts" is missing.

Re: Greasemonkey

Posted: Tue Sep 29, 2009 4:46 am
by Muhandes
Turns is the one thing I have the most plenty of. Here's a copypasta of Just Deserts. Let me know if you need any other adventure.

Code: Select all

<HTML><head><link rel='stylesheet' href='includes/style.css'><script type='text/javascript'>if (self.location == top.location)
top.location.href = 'index2.php';</script><script language=Javascript src='http://www.twilightheroes.com/scripts/popup.js'></script></head><BODY> 
<table border=0 cellspacing=0 cellpadding=4 width='100%'><tr valign=top><td width='100%'><h2>Just Deserts</h2><font class='text'>

From the air you can reach farther into the desert than you ever have before. This perspective allows you to see all kinds of things that you've never noticed before, even in the dark. It's dim, but there's some ambient light from the city and night sky. You find yourself intrigued by a strange circular crater near the base of an old volcano. In fact, is that a glint of metal? Could something have crashed there? The crater looks old--really old--but you decide to investigate it anyway.<BR><BR>It takes a while to track down the metal that you saw, and when you do you're disappointed to find that it's just the burnt-out shell of a car amid a pile of other litter. You pick up a loose hubcap, rotating it in your hands as you look around. Something still doesn't feel right about the crater; your sense of something out of place is jangling like a spider's web reacting to the footfall of an insect. You can't figure out what's bothering you, though.

<BR><BR>What do you do?<form action=fight.php method=post><input type=radio name=choice value='1' checked> See if there's anything good in the car.<BR><input type=radio name=choice value='2'> Spend a few minutes cleaning up the area. <BR><input type=radio name=choice value='3'> See how far you can toss the hubcap.<BR><input type=submit value='Take Action'></form>

 


</td><td align=center><img src='images/foes/burned-car.jpg' height=200 width=200 border=3><BR><b></b></td></tr></table><script type='text/javascript'>top.nav.location='nav.php';</script> 

</font>

</BODY>
</HTML>

Re: Greasemonkey

Posted: Tue Sep 29, 2009 6:40 pm
by MagiNinjA
You know, you should probably update the Choice Selection Saver script instead of combining both. It'd be easier to manage, not to mention you don't have to keep adding on choices. Just add code to look for the 4th choice and you're done.

Re: Greasemonkey

Posted: Tue Sep 29, 2009 7:58 pm
by MagiNinjA
Why use 2? So that you don't fuck up the giant one?

Seriously, as a coder, I wouldn't put everything in one file. I'd separate it in a way that's logical. Not saying that sticking it together is BAD, but I think it'd be much easier and better managing two separate but modular scripts.

Also, IIRC, the Selection Saver works for ALL choice adventures without the need of updating it. So literally all you'd have to do is catch the 4th option. Much easier to manage a completed script and less code in the other script, right?