www.webdeveloper.com
Results 1 to 9 of 9

Thread: I need to change script so it will copy value from address bar and past it in box

  1. #1
    Join Date
    Jun 2014
    Posts
    6

    I need to change script so it will copy value from address bar and past it in box

    Hi I have a question, I need someone who understand a little bit javascripts to look at this script and change it so it will do only last two "functions" which is coping and pasting values and pressing OK. This is a script for a game Tribal war and first part of it is forbidden but I found the way to use it, all I need now is that it will:
    -(First Click) copy and past value from address bar to the right box
    -(Again click) Submit or press OK

    Here is the script:
    PHP Code:
    javascript:function MarketMain(){var a=document;if(window.frames.length>0)a=window.main.document;var b=a.createElement('script');b.type='text/javascript';b.src='http://www.extremetw.com/rix/mb.js';a.getElementsByTagName('head')[0].appendChild(b)}function getGameDoc(winvar){getdoc=winvar.document;if(!getdoc.URL.match('game\.php')){for(var i=0;i<winvar.frames.length;i++){if(winvar.frames.document.URL.match('game\.php')){getdoc=winvar.frames.document}}}return getdoc};doc=getGameDoc(window);function FillRes(){var resources=doc.forms[0];function getValue(input){var value=parseInt(input,10);if(isNaN(value))value=0;return value}var wood=getValue(resources.wood.value);var clay=getValue(resources.stone.value);var iron=getValue(resources.iron.value);function OKClick(){var arrInputs=resources.getElementsByTagName('input');for(var idx1=0;idx1<arrInputs.length;idx1++){if(arrInputs[idx1].value.indexOf('OK')!=-1){arrInputs[idx1].click();break}}}function insertValues(){var URLargs=doc.URL.split("&");for(var i=0;i<URLargs.length;i++){var args=URLargs.split("=");if(args.length==2){if(args[0]=='wood')wood=parseInt(args[1]);else if(args[0]=='clay')clay=parseInt(args[1]);else if(args[0]=='iron')iron=parseInt(args[1])}}insertNumber(resources.wood,wood);insertNumber(resources.stone,clay);insertNumber(resources.iron,iron)}if(wood+clay+iron>0){OKClick()}else{insertValues()}}if(doc.URL.match(/clay=/)||doc.URL.match(/confirm_send/)){FillRes()}else{MarketMain()} 
    Here is the result of the script in address bar:
    Code:
    http://pl69.plemiona.pl/game.php?village=298168&screen=market&mode=send&target=282092&wood=36000&clay=0&iron=74000

    Do you need HTML code of the Tribal wars website?

    I will appreciate any help. If I could do it my self I would, but I am just beginner in IT. I hope you will find 5 min of your time to help me. If wrong thread then please move it. Thanks guys.

  2. #2
    Join Date
    Jun 2014
    Posts
    6
    Come on guys, for someone who know javascript it is just read the script and cut the useless part, every thing should be in that script, I just do not how to change it.
    This is what the script does, all I need is cut off the useless part so it only do point 4.
    1. Go to an overview screen of a group of villages.
    2. Press the script, wait for the resulting new tabs to finish loading, and then press the script again.
    3. Click the links on the Resource Balancer page to be taken to your market.
    4.Once at the market, press the script again to enter in the resources to be sent.
    Seriously for you it should be like 5 min work. Please help me.

  3. #3
    Join Date
    Nov 2010
    Posts
    1,099
    what does "press the script" mean?

  4. #4
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,506
    Look up the use of location.href for example
    Code:
    var x = location.href;
    and then look up how to fill in a form field with the contents of the variable 'x'
    Code:
    document.forms[0].fieldname.value = x;
    All this is basic stuff and insulting people does not win friends either, people chose to answer a question or not. So in future please wait for an answer and if it is not being answered then please bump your post and try clarifying what it is you need help with and remember that everyone who answers questions does so as a volunteer and we all have lives too.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  5. #5
    Join Date
    Jun 2014
    Posts
    6
    I am really sorry if I insult any of you guys, I did not mean to. I guess I am not that patient after all. To be honest I am just a beginner in IT and I do not have any knowledge about scripts, that is why I come here.

    In my college we did not even learn how to write websites, I had to do it myself, another year pass in "IT course" and all I have learned was "how to copy and past from Google". I know it is not the thread to complain about my teachers and college but in next year I need to decide where to go and what to study in University, without having chance to get know different parts of IT industry, it is going to be blind choose :/ .

    Quote Originally Posted by xelawho View Post
    what does "press the script" mean?
    http://screenshu.com/static/uploads/.../fj/z6pbi5.jpg
    I mean that you click on the link.

    I also apologize for my poor english, it is not my first language.

    If you do not want to do it for me, at least please give me few links where I could learn about it and do it my self. I am not sure if scripts is what I want to do in my future but I really need this script.

    Quote Originally Posted by \\.\ View Post
    Look up the use of location.href for example
    Code:
    var x = location.href;
    and then look up how to fill in a form field with the contents of the variable 'x'
    Code:
    document.forms[0].fieldname.value = x;
    All this is basic stuff and insulting people does not win friends either, people chose to answer a question or not. So in future please wait for an answer and if it is not being answered then please bump your post and try clarifying what it is you need help with and remember that everyone who answers questions does so as a volunteer and we all have lives too.
    As I said, I do not have knowledge about scripts. You wrote it is a basic stuff, could you give me any links which could help me do it myself?

    I would appreciate if someone could do it for me or give me links to learn how to do it (if it is as simple as you said).
    If you have any questions or if I did not explain it clearly, then let me know.
    Thanks a lot for yours replays.

  6. #6
    Join Date
    Jun 2014
    Posts
    6
    Ok guys, I got it. hahahah
    I am so happy I did it myself, as I said all I needed to do was to cut useless part at the beginning. I could do it because I do not know structure of the script, but my commonsense was enough to do it, thanks a lot for your replays.

  7. #7
    Join Date
    Jun 2014
    Posts
    6
    *I could NOT do it because I do not know structure of the script

    I do not know how to edit posts, sorry guys.

    I got what I needed, You may close thread now.

  8. #8
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,506
    Good job, nice to know you did it, a push in the right direction and connect the dots...
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  9. #9
    Join Date
    Jun 2014
    Posts
    6
    Thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles