Battle GG Maker

04/23/2011 00:39 userinit.exe#1
Most of you (men), probably during a fight using GG to restore HP, but to move from page to page too uncomfortable sometimes freezes sometimes something else.
Now I'll show you how to make a GG and a map together!
  1. Open the browser Opera.
  2. Go to the map
  3. We get down in a flush-free region
  4. Click RMB select the source code
  5. Copy the script (see script below), paste it to the end but until:
Code:
</body>
</html>
Click "Apply Changes " and voila, a button appears for GG!

------------------------------- 1st Script----------------------------------

Here's a variation with one button but without log and inappropriately insert SID & ID + GG Warning clicked yourself until you again click on the button!

Code:
<script>
    var req;
    var started = false;
    var url = '/flashinput/galaxyGates.php?userID=' + BpTrack['uid'] + '&action=energy&sid=' + BpTrack['sid'] + '&sample=1';
    var samples = '';

    function loadXMLDoc(url) {
        if (started == false)
            return;

        if (window.XMLHttpRequest) {
            req = new XMLHttpRequest();
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send(null);
        
        } else if (window.ActiveXObject) {
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req) {
                req.onreadystatechange = processReqChange;
                req.open("GET", url, true);
                req.send();
            }
        }
    }

    function processReqChange() {
        if (req.readyState == 4) {
            // для статуса "OK"
            if (req.status == 200) {
                // здесь идут всякие штуки с полученным ответом
        var start = req.responseText.indexOf('<samples>');
        var end = req.responseText.indexOf('</samples>');
        samples = req.responseText.substring(start + 9, end);
        if (started == true)
            document.getElementById('sample').innerHTML = "Energy stop " + samples;
        else
            document.getElementById('sample').innerHTML = "Energy start " + samples;    
            }
        }
    }

    function start() {
        if (started == true) {
            started = false;
            document.getElementById('sample').innerHTML = "Energy start " + samples;
        } else {
            started = true;
            document.getElementById('sample').innerHTML = "Energy stop " + samples;
        }
    }

    window.setInterval("loadXMLDoc(url)", 200);
</script>

<button id="sample" onclick="start(); return;">Energy start</button>
----------------------------- Script 2nd ---------------------------
The script itself takes SID & ID + a log, but no switch (that is, the button must be pressed himself).
Code:
<script>
    var req;
    var url = '/flashinput/galaxyGates.php?userID=' + BpTrack['uid'] + '&action=energy&sid=' + BpTrack['sid'] + '&sample=1';
    var money = '';
    var samples = '';
    var battery = ['', '', 'MCB-25', 'MCB-50', 'UCB-50', 'SAB'];
    var gate = ['', 'α', 'β', 'γ', 'δ'];


    function loadXMLDoc(url) {
        if (window.XMLHttpRequest) {
            req = new XMLHttpRequest();
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send(null);
        } else if (window.ActiveXObject) {
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req) {
                req.onreadystatechange = processReqChange;
                req.open("GET", url, true);
                req.send();
            }
        }
    }

    function processReqChange() {
        if (req.readyState == 4) {
            // для статуса "OK"
            if (req.status == 200) {
                // здесь идут всякие штуки с полученным ответом
                xml = req.responseXML;

                if (xml.getElementsByTagName('error')[0] !== undefined) {
                    return;
                }

                samples = xml.getElementsByTagName('samples')[0].firstChild.nodeValue;
                money = xml.getElementsByTagName('money')[0].firstChild.nodeValue;

                update();
        
                var items = xml.getElementsByTagName('item');

                for (var i = 0; i < items.length; i++) {
                    var item = items[i];
                    var type = item.getAttribute('type');
                    if (type == 'hitpoints') {
                        log(item.getAttribute('amount') + ' Extra Strength');
                    } else if (type == 'rocket') {
                        var item_id = item.getAttribute('item_id');
                        var amount = item.getAttribute('amount');
                        if (item_id == '11') {
                            if (amount == '1')
                                log('1 Bomb ACM-1');
                            else
                                log('Bomb ACM-1 (' + amount + ' шт.)');
                        } else
                            log('Rockets PLT-2021 (' + amount + ' шт.)');
                    } else if (type == 'battery') {
                        log('Type: ' + battery[item.getAttribute('item_id')] + ' (' + item.getAttribute('amount') + ' шт.)');
                    } else if (type == 'ore') {
                        log('Type: Xenomit (' + item.getAttribute('amount') + ' шт.)');
                    } else if (type == 'logfile') {
                        var amount = item.getAttribute('amount');
                        if (amount == '1')
                            log('1 log-disk');
                        else
                            log('Log-disks: ' + amount);
                    } else if (type == 'voucher') {
                        var amount = item.getAttribute('amount');
                        if (amount == '1')
                            log('1 Coupon repair');
                        else
                            log(amount + 'Coupon repair');
                    } else if (type == 'part') {
                        var duplicate = item.getAttribute('duplicate');
                        if (duplicate != undefined)
                            log('Multiplier x' + xml.getElementsByTagName('multiplier')[0].getAttribute('value'));
                        else
                            log('Part ' + item.getAttribute('part_id') + '/teleport ' + gate[item.getAttribute('gate_id')]);
                    }
                }
            }
        }
    }

    function update() {
        document.getElementById('sample').innerHTML = "Energy | URI: " + money + " | Energy: " + samples;
    }

    function log(message) {
        document.getElementById('log').innerHTML = message + '\n' + document.getElementById('log').innerHTML;
    }
</script>

<button id="sample" onclick="loadXMLDoc(url);">Energy</button><br />
<textarea id="log" cols="50" rows="3">Galaxy Gates log...</textarea>
[Only registered and activated users can see links. Click Here To Register...]
04/23/2011 00:40 rotus14#2
Nice
04/23/2011 06:40 Dx555#3
Can u make video for this script?
04/25/2011 23:07 userinit.exe#4
Quote:
Originally Posted by Dx555 View Post
Can u make video for this script?
Video is in the first post.