» »

JavaScript pomoč

JavaScript pomoč

Tub ::

Pozdravljeni!

Jaz nimam pojma o programiranju rabu bi pa pomoč pri spremembi tele skripte

"
// ==UserScript==
// @name           fallensword_kill_all
// @namespace      fallensword_kill
// @include        http://*fallensword.com/*
// ==/UserScript==

function $(id) {
	return document.getElementById(id);
}

var fsKillEmAll = {
  attack   : {
    aLinkId        : 'aLink',
    maxKills       : 8,
    
    
    repairItemsLink : 'http://fallensword.com/index.php?cmd=blacksmith&subcmd=repairall&fromworld=1'
    
  },
  
  kill : function (index) {
    var attackLink = $(fsKillEmAll.attack.aLinkId+index).href;
    var xReq       = new XMLHttpRequest;
    xReq.open("GET", attackLink, true);
    xReq.onreadystatechange = function (){
                                if ( this.readyState == 4 ) {
                                  fsKillEmAll.displayCombatResults(index,this.responseText);
                                }
      
                              };
    xReq.send(null);
  },
  
  displayCombatResults : function (index, rT) {
    var scriptStart = rT.indexOf("// combat animator");
    var scriptEnd   = rT.indexOf("// image sequencing",scriptStart);
    var scriptStr   = rT.substr(scriptStart, scriptEnd-scriptStart);
    eval(scriptStr);
    var container = $(fsKillEmAll.attack.aLinkId+index).parentNode.parentNode;
    container.align="left";
    container.width="80%";
    container.parentNode.childNodes.item(2).width="15%";
    var tmpStr = (winner == 0) ? '<span style="color:green;font-size:12px;width:100px">' : '<span style="color:red">';
    container.innerHTML = tmpStr +
                          "<b>Gold</b> : " + goldStolen +
                          " / <b> XP</b> : " + xpGain  +
                          "/ <b>Stamina</b> : " + Math.round(combatStages/2)+"</span>";
    if (levelUp >0) container.innerHTML = container.innerHTML + "<br />Level UP";
    else if(levelUp < 0) container.innerHTML = container.innerHTML + "<br />Level DECREASED";
    
    if (itemId>0) {
      var lootedItemImage = "http://66.7.192.165/items/"+itemId+".gif";
      container.innerHTML = container.innerHTML +
                            '<br /><img src="'+lootedItemImage+'" />';
    }
    
  },
  
  killEmAll : function () {
    for(i=1;i<=fsKillEmAll.attack.maxKills;i++) {
      fsKillEmAll.kill(i);
      var x       = new XMLHttpRequest;
      x.open("GET", fsKillEmAll.attack.repairItemsLink, true);
      x.send(null);
    }

  }
}

fsKillEmAll.killEmAll();

"


skripta v bistvu sedaj pobije vse kar je na mapi ko se premikaš po njej
Mene pa zanima če se da narediti tako, da bi pobilo samo 1 tip moba ki bi vstavil njegovo ime notr
tukji je pa koda od paga
-----------------------------
-----------------------------
 null

null


---------------------------------
---------------------------------

momentalno sta 2 moba na tej poziciji in sicer
-Ramdal Stalker
-Hell Hound

in jaz bi rad ubil samo Hell Hound

PROSIM ZA POMOČ

-----------------------------------
-----------------------------------
 

keworkian ::

Igraj posteno.
Obscenities in B-Flat

Tub ::

Saj tukaj ni kaj če je skripta odobrena v čem je pol problem!

LeQuack ::

Tub je izjavil:

Saj tukaj ni kaj če je skripta odobrena v čem je pol problem!


To naj bi bilo to:
// ==UserScript==
// @name           fallensword_kill_all
// @namespace      fallensword_kill
// @include        http://*fallensword.com/*
// ==/UserScript==

function $(id) {
	return document.getElementById(id);
}

var fsKillEmAll = {
	attack : {
		aLinkId : 'aLink',
		maxKills : 8,

		repairItemsLink : 'http://fallensword.com/index.php?cmd=blacksmith&subcmd=repairall&fromworld=1'
	},

	kill : function(index) {
		var attackLink = $(fsKillEmAll.attack.aLinkId + index).href;
		var xReq = new XMLHttpRequest;
		xReq.open("GET", attackLink, true);
		xReq.onreadystatechange = function() {
			if (this.readyState == 4) {
				fsKillEmAll.displayCombatResults(index, this.responseText);
			}

		};
		xReq.send(null);
	},

	displayCombatResults : function(index, rT) {
		var scriptStart = rT.indexOf("// combat animator");
		var scriptEnd = rT.indexOf("// image sequencing", scriptStart);
		var scriptStr = rT.substr(scriptStart, scriptEnd - scriptStart);
		eval(scriptStr);
		var container = $(fsKillEmAll.attack.aLinkId + index).parentNode.parentNode;
		container.align = "left";
		container.width = "80%";
		container.parentNode.childNodes.item(2).width = "15%";
		var tmpStr = (winner == 0) ? '<span style="color:green;font-size:12px;width:100px">'
				: '<span style="color:red">';
		container.innerHTML = tmpStr + "<b>Gold</b> : " + goldStolen
				+ " / <b> XP</b> : " + xpGain + "/ <b>Stamina</b> : "
				+ Math.round(combatStages / 2) + "</span>";
		if (levelUp > 0)
			container.innerHTML = container.innerHTML + "<br />Level UP";
		else if (levelUp < 0)
			container.innerHTML = container.innerHTML + "<br />Level DECREASED";

		if (itemId > 0) {
			var lootedItemImage = "http://66.7.192.165/items/" + itemId
					+ ".gif";
			container.innerHTML = container.innerHTML + '<br /><img src="'
					+ lootedItemImage + '" />';
		}

	},

	killSelected : function(name, maxToSearch) {
		for (i = 1; i <= maxToSearch; i++) {
			var attackLink = $(fsKillEmAll.attack.aLinkId + i);
			if (attackLink == null)
				continue;

			var parent = attackLink.parentNode;
			while (parent != null && parent.tagName != "TR") {
				parent = parent.parentNode;
			}
			if (parent == null)
				continue;

			var children = parent.childNodes;
			if (children == null)
				continue;

			for (j = 0; j <= children.length; j++) {
				var childNode = children[j];
				if (childNode != null && childNode.tagName == "TD") {
					var childText = childNode.innerHTML;
					if (childText.toLowerCase().indexOf(name.toLowerCase()) != -1) {
						fsKillEmAll.kill(i);
						var x = new XMLHttpRequest;
						x.open("GET", fsKillEmAll.attack.repairItemsLink, true);
						x.send(null);
					}
				}
			}
		}

	}
}

//Ime moba ter max mobov, ki se jih preisce
fsKillEmAll.killSelected('Ramdal Stalker', 100);


Za druge parametre spremniš stavek na koncu:
//Ime moba ter max mobov, ki se jih preisce
fsKillEmAll.killSelected('Ramdal Stalker', 100);
Quack !

Zgodovina sprememb…

  • spremenil: LeQuack ()


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

[PHP/JavaScript] tic tac toe

Oddelek: Programiranje
171679 (1412) illion
»

Google odšteva

Oddelek: Novice / Omrežja / internet
295604 (3994) MrStein
»

Javascript problemcek

Oddelek: Programiranje
141594 (1387) tempoFlow
»

[question]neki glede menija

Oddelek: Izdelava spletišč
151613 (1492) tec
»

Kako se tole naredi?

Oddelek: Izdelava spletišč
261498 (1198) njok

Več podobnih tem