Scripts for Mac

  • Thread starter DeletedUser4439
  • Start date

DeletedUser4439

Guest
I have a Mac that runs OS X. I have problems running a script for farming. Whenever I try to bookmark the script, clicking the bookmark does nothing. I have also tried firefox and chrome and the same problem occurs. I do not have premium nor do I plan on getting it. Does anyone know what I can do?
 

DeletedUser

Guest
Are you running the script in Opera? I have a mac myself, but have never had trouble. Also, what script are you attempting to run?
 

DeletedUser4439

Guest
Well I have tried firefox and chrome with no luck. I am running a javascript script that zomgtw produces out of the farm finder. I used to use it on my pc with no problem. But with my mac nothing is put into troop counts or coords when I hit the bookmark.
Should I try Opera?
 
Last edited by a moderator:

DeletedUser

Guest
Opera is the browser that most of the scripts are configured to work with. It's typically used because the browser shortcuts can greatly increase how fast you send attacks and so on, information on which you can find in the Guide Library in the Guides Forum :). I'd suggest trying it in Opera, and if it still doesn't work then coming back to here and we'll try to troubleshoot from there :).
 

DeletedUser4439

Guest
OK so I downloaded Opera 12 so I can use bookmarks on any tab. Still, nothing is being entered for coords or troops.

Here is my script

javascript:var cook="1019853";sp=0;sw=0;ax=0;ar=0;scout=2;lc=10;ma=0;hv=0;cat=0;ra=0;no=0;kn=0;coords="555|606 554|605 554|606 556|604 553|607 552|605 558|605 552|607 553|608 558|607 558|604 556|608 556|602 ";var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;if(url.indexOf("screen=place")==-1)alert("This%20script%20needs%20to%20be%20run%20from%20the%20rally%20point");coords=coords.split("%20");index=0;farmcookie=document.cookie.match("(^|;) ?"+cook+"=([^;]*)(;|$)");if(farmcookie!=null)index=parseInt(farmcookie[2]);if(index>=coords.length)alert("last village");if(index>=coords.length)index=0;coords=coords[index];coords=coords.split("|");index=index+1;cookie_date=new%20Date(2015,11,11);document.cookie =cook+"="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];insertUnit(doc.forms[0].spear,sp);insertUnit(doc.forms[0].knight,kn);insertUnit(doc.forms[0].marcher,ma);insertUnit(doc.forms[0].archer,ar);insertUnit(doc.forms[0].snob,no);insertUnit(doc.forms[0].sword,sw);insertUnit(doc.forms[0].axe,ax);insertUnit(doc.forms[0].spy,scout);insertUnit(doc.forms[0].light,lc);insertUnit(doc.forms[0].heavy,hv);insertUnit(doc.forms[0].ram,ra);insertUnit(doc.forms[0].catapult,cat);end();
 
Last edited by a moderator:

DeletedUser

Guest
Strange, it works for me.

Make sure you copy the script exactly as I post it below, start to finish, and put it into the "Address" area of the bookmark.

[noparse]javascript:var cook="1019853";sp=0;sw=0;ax=0;ar=0;scout=2;lc=10;ma=0;hv=0;cat=0;ra=0;no=0;kn=0;coords="555|606 554|605 554|606 556|604 553|607 552|605 558|605 552|607 553|608 558|607 558|604 556|608 556|602 ";var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=document.URL;if(url.indexOf("screen=place")==-1)alert("This%20script%20needs%20to%20be%20run%20from%20the%20rally%20point");coords=coords.split("%20");index=0;farmcookie=document.cookie.match("(^|;) ?"+cook+"=([^;]*)(;|$)");if(farmcookie!=null)index=parseInt(farmcookie[2]);if(index>=coords.length)alert("last village");if(index>=coords.length)index=0;coords=coords[index];coords=coords.split("|");index=index+1;cookie_date=new%20Date(2015,11,11);document.cookie =cook+"="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];insertUnit(doc.forms[0].spear,sp);insertUnit(doc.forms[0].knight,kn);insertUnit(doc.forms[0].marcher,ma);insertUnit(doc.forms[0].archer,ar);insertUnit(doc.forms[0].snob,no);insertUnit(doc.forms[0].sword,sw);insertUnit(doc.forms[0].axe,ax);insertUnit(doc.forms[0].spy,scout);insertUnit(doc.forms[0].light,lc);insertUnit(doc.forms[0].heavy,hv);insertUnit(doc.forms[0].ram,ra);insertUnit(doc.forms[0].catapult,cat);end();[/noparse]
 

DeletedUser4439

Guest
Same problem.

Here is a screenshot from the error console for java.

51x11x.png
 

DeletedUser

Guest
Hm, I'll take a look into that and see if anyone I know has an answer. I'll possibly find it myself later :).
 

DeletedUser

Guest
try this:

Code:
javascript:var cook="1019853";sp=0;sw=0;ax=0;ar=0;scout=2;lc=10;ma=0;hv=0;cat=0;ra=0;no=0; kn=0;coords="555|606 554|605 554|606 556|604 553|607 552|605 558|605 552|607 553|608 558|607 558|604 556|608 556|602 ";var%20doc=document;url =document.URL;if(url.indexOf("screen=place")==-1)alert("This%20script%20needs%20to%20be%20run%20from%20the%20rally%20point ");coords=coords.split("%20");index=0;farmcookie=document.cookie.match("(^| ;) ?"+cook+"=([^;]*)(;|$)");if(farmcookie!=null)index=parseInt(farmcookie[2]);if(index>=coords.length)alert("last village");if(index>=coords.length)index=0;coords=coords[index];coords=coords.split("|");index=index+1;cookie_date=new%20Date(2015,11,11); document.cookie =cook+"="+index+";expires="+cookie_date.toGMTString ();doc.forms[0].x.value=coords[0];doc.forms[0].y.value=coords[1];insertUnit(doc.forms[0].spear,sp);insertUnit(doc.forms[0].knight,kn);insertUnit(doc.forms[0].marcher,ma);insertUnit(doc.forms[0].archer,ar);insertUnit(doc.forms[0].snob,no);insertUnit(doc.forms[0].sword,sw);insertUnit(doc.forms[0].axe,ax);insertUnit(doc.forms[0].spy,scout);insertUnit(doc.forms[0].light,lc);insertUnit(doc.forms[0].heavy,hv);insertUnit(doc.forms[0].ram,ra);insertUnit(doc.forms[0].catapult,cat);void 0;
 

DeletedUser

Guest
Most scripts require premium account and are not ment run as bookmarks.
 

DeletedUser

Guest
True enough, but there is no rule against them as long as they don't emulate a premium account's feature(s) :).
 

DeletedUser4439

Guest
Works perfectly. What did you change about the script so that I can fix it for future purposes?
 

DeletedUser

Guest
Great :)

1) removed
Code:
if(window.frames.length>0)doc=window.main.document;
(new layout - tw doesn't use a main frame and an ad frame any more, and I'm pretty sure tribal forums don't use frames either)

Users without premium accounts would have an iframe for the ad, causing this code to be executed. But window.main is undefined, which causes the script to crash. Users with premium account wouldn't experience any trouble as it would skip over this code.

2) replaced
Code:
end()
with
Code:
void 0;
(there is no end function defined)
 
Last edited by a moderator:
Top