BankrollMob Forum

BankrollMob Forum » Off-Topic » Javascript help needed


Javascript help needed   0   
Anyone here know how to use javascript?

Specifically I am trying to use a simple bot on a sort of betting/rolling dice site.

I want to have some fun testing this "bot" on the old loosing method of martingale system (with some sort of free money they give away hourly) and would like to change some variables to see how bot/site behave consequently.


My problem is I can't understand which command lines contain the variables I'd like to change.

If someone of you mobsters have the needed knowledge and want to spend some minutes for this let me know.

thx in advance for your cooperation Worship Worship Worship

     
   0   
Sure, what is it that you want to know?

Javascript is a secondary language for me (just picked it up as I went along, never really studied it though).

     
   +1   
$('body').append('<div style="position:fixed;top:0;left:0;width:100%;height:100%;min-height:100%;text-align: center;z-index:100000;background-color:white;" class=""><table style="margin:0 auto;"><tr><td>balance</td><td id="balance_b"></td></tr><tr><td>win</td><td id="roundwin_b"></td></tr><tr><td>bet</td><td id="current_bet_b"></td></tr><tr><td>time</td><td id="time_b"></td></tr></table></div>');

bconfig = {
maxBet: 0.00001024,
wait: 1,
toggleHilo: false,
alertMultiplier: 5
};

initialBalance = parseFloat($('#balance').html());
hilo = 'hi';
multiplier = 1;
startTime = new Date().getTime();
rollDice = function() {

if ($('#double_your_btc_bet_lose').html() !== '') {
$('#double_your_btc_2x').click();
multiplier++;
if (bconfig.toggleHilo) toggleHiLo();
} else {
setStartBet();
$('#double_your_btc_bet_win').html('');
var cmsg = {
lose: $('#double_your_btc_bet_lose').html(),
win: $('#double_your_btc_bet_win').html()
};
cmsg = JSON.stringify(cmsg);
}

if (multiplier > bconfig.alertMultiplier) {
if (window.confirm("You have already lost " + (Math.pow(2, (multiplier - 1)) - 1) + " and you are about to lose " + Math.pow(2, (multiplier - 1)) + ". Click 'cancel' to reset the bet amount to 1 or 'ok' to take the risk?" Blink) {

} else {
$('#double_your_btc_min').click();
multiplier = 1;
}

$('#double_your_btc_bet_' + hilo + '_button').click();
} else {
if (parseFloat($('#balance').html()) < (parseFloat($('#double_your_btc_stake').val()) * 2) ||
parseFloat($('#double_your_btc_stake').val()) > bconfig.maxBet) {
$('#double_your_btc_min').click();
multiplier = 1;
}

$('#double_your_btc_bet_' + hilo + '_button').click();
}



// setTimeout(rollDice, (multiplier * bconfig.wait) + Math.round(Math.random() * 100));
};

toggleHiLo = function() {
if (hilo === 'hi') {
hilo = 'lo';
} else {
hilo = 'hi';
}
};

setStartBet = function() {
$('#double_your_btc_min').click();
multiplier = 1;
// if ((Math.random() * 10) > 5) {

// } else {
// $('#double_your_btc_min').click();
// $('#double_your_btc_2x').click();
// multiplier = 2;
// }
}

currentMsg = '';
bChange = function(next) {
var cmsg = {
lose: $('#double_your_btc_bet_lose').html(),
win: $('#double_your_btc_bet_win').html()
};
cmsg = JSON.stringify(cmsg);
if (currentMsg !== cmsg) {
$('#balance_b').html($('#balance').html());
$('#roundwin_b').html((parseFloat($('#balance').html()) - initialBalance).toFixed(8));
$('#current_bet_b').html($('#double_your_btc_stake').val());
$('#time_b').html((Math.round(((new Date().getTime()) - startTime) / 1000) / 60 / 60).toFixed(2) + ' h');
currentMsg = cmsg;
next();
}
setTimeout(function() {
setTimeout(function() {
bChange(next);
}, bconfig.wait)

}, 50);
};
bChange(rollDice);$('body').append('<div style="position:fixed;top:0;left:0;width:100%;height:100%;min-height:100%;text-align: center;z-index:100000;background-color:white;" class=""><table style="margin:0 auto;"><tr><td>balance</td><td id="balance_b"></td></tr><tr><td>win</td><td id="roundwin_b"></td></tr><tr><td>bet</td><td id="current_bet_b"></td></tr><tr><td>time</td><td id="time_b"></td></tr></table></div>');

bconfig = {
maxBet: 0.00001024,
wait: 1,
toggleHilo: false,
alertMultiplier: 5
};

initialBalance = parseFloat($('#balance').html());
hilo = 'hi';
multiplier = 1;
startTime = new Date().getTime();
rollDice = function() {

if ($('#double_your_btc_bet_lose').html() !== '') {
$('#double_your_btc_2x').click();
multiplier++;
if (bconfig.toggleHilo) toggleHiLo();
} else {
setStartBet();
$('#double_your_btc_bet_win').html('');
var cmsg = {
lose: $('#double_your_btc_bet_lose').html(),
win: $('#double_your_btc_bet_win').html()
};
cmsg = JSON.stringify(cmsg);
}

if (multiplier > bconfig.alertMultiplier) {
if (window.confirm("You have already lost " + (Math.pow(2, (multiplier - 1)) - 1) + " and you are about to lose " + Math.pow(2, (multiplier - 1)) + ". Click 'cancel' to reset the bet amount to 1 or 'ok' to take the risk?" )) {

} else {
$('#double_your_btc_min').click();
multiplier = 1;
}

$('#double_your_btc_bet_' + hilo + '_button').click();
} else {
if (parseFloat($('#balance').html()) < (parseFloat($('#double_your_btc_stake').val()) * 2) ||
parseFloat($('#double_your_btc_stake').val()) > bconfig.maxBet) {
$('#double_your_btc_min').click();
multiplier = 1;
}

$('#double_your_btc_bet_' + hilo + '_button').click();
}



// setTimeout(rollDice, (multiplier * bconfig.wait) + Math.round(Math.random() * 100));
};

toggleHiLo = function() {
if (hilo === 'hi') {
hilo = 'lo';
} else {
hilo = 'hi';
}
};

setStartBet = function() {
$('#double_your_btc_min').click();
multiplier = 1;
// if ((Math.random() * 10) > 5) {

// } else {
// $('#double_your_btc_min').click();
// $('#double_your_btc_2x').click();
// multiplier = 2;
// }
}

currentMsg = '';
bChange = function(next) {
var cmsg = {
lose: $('#double_your_btc_bet_lose').html(),
win: $('#double_your_btc_bet_win').html()
};
cmsg = JSON.stringify(cmsg);
if (currentMsg !== cmsg) {
$('#balance_b').html($('#balance').html());
$('#roundwin_b').html((parseFloat($('#balance').html()) - initialBalance).toFixed(8));
$('#current_bet_b').html($('#double_your_btc_stake').val());
$('#time_b').html((Math.round(((new Date().getTime()) - startTime) / 1000) / 60 / 60).toFixed(2) + ' h');
currentMsg = cmsg;
next();
}
setTimeout(function() {
setTimeout(function() {
bChange(next);
}, bconfig.wait)

}, 50);
};
bChange(rollDice);

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

Thx mate.

The bot I posted (don't know if bot is the right name for this commands) perform basically these simple following actions:

- bets 0.00000001 (min bet available) on HI
- then roll the "dice"
- if wins then bets 0.00000001 on LOW and roll the dice
- if looses then double the bet on HI and roll the dice again

I would like to change the min bet amount to 0.00000002 (or 3 or 4 or 5 etc depending on my available balance but can't understand how to do it.


PS: there are also useful side features like: time counter, win/loose counters, pop up alert and so on but we may discuss about them eventually later on if you like

Worship Worship Worship

     
   +1   
Okay, some messy code here...

It seems to me that this script interacts with the page using jQuery. The page itself has an element that holds the initial stake: '#double_your_btc_stake'.

You could try adding a line like:

$('#double_your_btc_stake').val('0.00000002');

just before the last line...
Good luck...

     
   0   
Posted by marqis:
Okay, some messy code here...

It seems to me that this script interacts with the page using jQuery. The page itself has an element that holds the initial stake: '#double_your_btc_stake'.

You could try adding a line like:

$('#double_your_btc_stake').val('0.00000002');

just before the last line...
Good luck...



when you go to that page it has the min value bet (0.00000001) prefilled in the suitable field (hope it answers to your jQuery statement).

back to your suggestion: should I type that line

between

};

and

bChange(rollDice);

did I get you correctly?

     
   +1   
Yes, that's right.

     
   0   
Posted by marqis:
Yes, that's right.


will have a try

Worship Worship Worship Worship Worship Worship Worship

     
   0   
Unfortunately it doesn't work

     
   0   
You could try a bit of debugging:
- Open the page in chrome, and press f12 (this opens the developer tools)
- Open the "console" tab
- Enter the string I gave you $('#double_your_btc_stake').val('0.00000002'); at the prompt, and press enter. See if the value of the stake is changed from 0.00000001 to 0.00000002

If it's some other element's value you wish to adjust, just right click it and select "Inspect element", there you can see it's id, and you can set it by using the statement I gave you, replacing double_your_btc_stake with that id.

Or is that not the point? Hard to tell, since I don't know what's on the page...

Good luck...

Edited by marqis (04 January 2014 @ 18:27 GMT)


     
   0   
I think everywhere that is says "multiplier = 1"I would change it to "= 2". Since the setStartBet function sets the value to '1'.. That would be my guess.. Also - I don't think that's JQuery is it? It using JSON to send the webrequests..

------------
Although, Marqis is definitely right about using the debbuger.. You can 'trace/track'all the variables using the inbuilt Firefox debugger (IE and Chrome have debugger as well, FF is the best, although the latest version of IE has a pretty good one too).

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

See this bit here:

if (multiplier > bconfig.alertMultiplier) {
if (window.confirm("You have already lost " + (Math.pow(2, (multiplier - 1)) - 1) + " and you are about to lose " + Math.pow(2, (multiplier - 1)) + ". Click 'cancel' to reset the bet amount to 1 or 'ok' to take the risk?" )) {

} else {
$('#double_your_btc_min').click();
multiplier = 1;
}


That's a pop-up window and it says press cancel to set bet amount to 1, then if you read the else block, which I think is what get's executed if you hit cancel, it sets the multiplier back to 1.. So I think you should set the value to '2'everywhere that you see it being set to 1.

------------
This:



if ($('#double_your_btc_bet_lose').html() !== '') {
$('#double_your_btc_2x').click();
multiplier++;



Seems to be saying, if bet is lost then increase multiplier by 1 (multiplier++ is the same as multiplier = multiplier + 1)

Edited by jessthehuman (05 January 2014 @ 08:44 GMT)


     
   0   
Posted by jessthehuman:
Also - I don't think that's JQuery is it?

The $('#xxx') syntax is used by jQuery to find the element with identifier xxx on the page.

So $('#xxx').val() would get/set the value of the element with id xxx (for instance an input textbox).

I believe there are other javascript libraries that use the $ function as a shortcut, other than jQuery, but jQuery is the most common.

     
   0   
Ah right, I don't have a whole lot of JQuery experience.. I work full time as a software developer, but I mostly write application code (C#, C, SQL) - but I do a little bit of web dev work as well (mostly the ASP/C#/SQL back end - but a bit of HTML/CSS/JS too - a couple of the landing page templates we've been using have a bit of JQuery functionality, but it's definitely not my strong suit).

Also - I notice this code uses JSON - I've been writing a wrapper (DLL) recently using a third-party web-service API and the web service calls are made through JSON - so have to wrap the JSON requests in .NET objects and then send them off.. It's a really really ugly way of coding, I had to download a third-party restClient app that I can use to test the web requests (much quicker than having to recompile all my code during debug phase).

     
   0   
just bump this thread to advise people with these skills I came to know of an offer for javascript coders where you may earn bitcoins if u are interested.


     
BankrollMob Forum » Off-Topic » Javascript help needed

 
Forum Rules | Support & FAQ

Disclosure: BankrollMob may earn a commission based on the advertisement material on this site. #AD

© 2024 BankrollMob.com - All Rights Reserved CONTACT | ABOUT | PRIVACY & COOKIE POLICY | TERMS & CONDITIONS | NEWSLETTER | AFFILIATES | REPORT SPAM | ADVERTISING
  Please Play Responsibly