Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Tutorial Dynamic Signatures

Joined
Jan 8, 2015
Messages
1,426
This post will be updated when I finish fapping.

Code snippet one;
Code:
package com.runemate.geashawscripts.dynamicSignatureTutorial;

//Imports are all the classes that we are going to use methods from

import com.runemate.game.api.hybrid.RuneScape;
import com.runemate.game.api.hybrid.util.StopWatch;
import com.runemate.game.api.script.framework.LoopingScript;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class dynamicSignatureTutorial extends LoopingScript {

    private String userName;

    private final StopWatch runtime = new StopWatch();
    private StopWatch updateTimer = new StopWatch();
    private final int updateInterval = 15000;

    private long timeRanSoFar, lastRunTime;

    private int xpGained = 0, expGainedSoFar = 0, lastExpGained,
    hidesTanned = 0, hidesTannedSoFar = 0, lastHidesTanned = 0,
    profitMade = 0, profitMadeSoFar = 0, lastProfitMade = 0,
    userId;

    @Override
    public void onStart(String...args) {
        // Getting the forum data.
        userId = com.runemate.game.api.hybrid.Environment.getForumId();
        userName = com.runemate.game.api.hybrid.Environment.getForumName();
        // Starting both timers.
        runtime.start();
        updateTimer.start();
        // Standard loop delay little slower than normal.
        setLoopDelay(100, 200);
    }

    @Override
    public void onPause() {
        runtime.stop();
    }

    @Override
    public void onResume() {
        runtime.start();
    }

    @Override
    public void onLoop() {

        // Check if the user is logged in.
        if (RuneScape.isLoggedIn()) {

            // Update the database.
            if (updateTimer.getRuntime() > updateInterval) {

                timeRanSoFar = (runtime.getRuntime() - lastRunTime) / 1000;
                expGainedSoFar = xpGained - lastExpGained;
                profitMadeSoFar = profitMade - lastProfitMade;
                hidesTannedSoFar = hidesTanned - lastHidesTanned;

                updateDatabase(userId, userName, timeRanSoFar, expGainedSoFar, profitMadeSoFar, hidesTannedSoFar);

                updateTimer.reset();

                // Reset xp gained, profit made and hides tanned.
                lastRunTime = runtime.getRuntime();
                lastExpGained = xpGained;
                lastProfitMade = profitMade;
                lastHidesTanned = hidesTanned;
            }
        }
    }

    private void updateDatabase(int userId, String userName, long time, int exp, int profit, int hidesTanned) {

        System.out.println("--- Inserting data into the database ---");
        System.out.println("1. Runtime: " + time);
        System.out.println("2. Experience: " + exp);
        System.out.println("3. Profit made: " + profit);
        System.out.println("4. Hides tanned: " + hidesTanned);

        try {
            String website = "http://example.com";
            URL submit = new URL(website + "/update?uid=" + userId + "&username=" + userName + "&runtime=" + (time / 1000) + "&exp=" + exp + "&profit=" + profit + "&hides=" + hidesTanned);
            URLConnection connection = submit.openConnection();
            connection.setDoInput(true);
            connection.setDoOutput(true);
            connection.setUseCaches(false);
            final BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String line;

            while ((line = rd.readLine()) != null) {
                if (rd.readLine().contains("success")) {
                    System.out.println("Successfully updated!");
                } else if (line.toLowerCase().contains("fuck off")) {
                    System.out.println("Something is fucked up, couldn't update!");
                }
                rd.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Last edited:
Joined
Feb 24, 2015
Messages
1,202
I think runemate should implement this :p and not the scripts :)
Like per user what type of xp (like in skills), money made, time ran, what script he/she used :)
@Arbiter
 
Joined
Dec 10, 2014
Messages
3,332
I think runemate should implement this :p and not the scripts :)
Like per user what type of xp (like in skills), money made, time ran, what script he/she used :)
@Arbiter
RM would need to provide the server, the tables for data for each bot, the API etc. in that case.
It would be nice though, but it's more feasible for the Bot Authors to do it atm :/
 
Joined
Apr 18, 2015
Messages
408
RM would need to provide the server, the tables for data for each bot, the API etc. in that case.
It would be nice though, but it's more feasible for the Bot Authors to do it atm :/
inb4runematecontrolappformobilephones
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
inb4runematecontrolappformobilephones
Defeat3d and I were working on one for android, tbh we got pretty damn far regarding it, we were able to shut down, pause and resume the bot, request a paint aswell as a canvas update and requesting updates on kills, profit etc.
But since no one of us has time to spend on scripting atm we don't know if it's ever to come out :/
 
Top