Jump to content

Help inject java...limbo


SineC
 Share

Recommended Posts

Hi everyone

I'm used to using inject script for limbo(with help from other scripts i found here). But since the changes from bc, no more lbg. So was woundering if anyone knows if there is still a way to script game for limbo?

Thanks

Link to comment
Share on other sites

Certainly, it seems like the scripting method you were using for "Limbo" involving "lbg" was affected by changes made by "bc." These changes might have made the previous scripting approach obsolete. If you're looking for an alternative way to script the game after these changes, it's recommended to seek advice from the game's community or forums to find out if there are new methods or tools available for scripting in the updated version of the game. Always make sure to follow the game's guidelines and terms of service when attempting any scripting or modding.

Link to comment
Share on other sites

  • 3 weeks later...
On 8/7/2023 at 3:07 AM, SineC said:

Hi everyone

I'm used to using inject script for limbo(with help from other scripts i found here). But since the changes from bc, no more lbg. So was woundering if anyone knows if there is still a way to script game for limbo?

Thanks

Nice post

 

Link to comment
Share on other sites

  • 10 months later...

so i just did this for coin flip, and if you don't mind that the UI doesn't animate you could do something like:


const source2 = document.location.hostname;

var i_cfg;
var i_players;
var i_externals;

var c_cfg;
var c_betvalue;
var c_decimal;

function PlayWinSound()
{
	var winSound = new Audio('https://freesound.org/people/MaoDin204/sounds/721774/download/721774__maodin204__cash-register.mp3');
	winSound.play();
}

async function GetItReady()
{
	i_cfg = await import("https://" + source2 + "/modules/games/Game-83ebef56.js");
	i_players = await import("https://" + source2 + "/modules/games/AllPlayers-fab6a982.js").then(res=>i_bet = res);
	i_externals = globalThis["@bc/ui"];

	c_cfg = new i_cfg.default;
	//c_betvalue = i_externals.socket.encode(i_bet.$.roots.gameLimbo.BetValue);
	c_decimal = i_externals.Decimal.clone({
		precision: 9
	});
	c_cfg.gameUnique='CoinFlip';
	c_cfg.initialize();
	
}

GetItReady();

var hasWon = false;
var gamecount = 0;
var shouldStop = false;
var mostFlips = 0;
var totalFlipsForAverage = 0;
var netProfit = 0;

function StopGames()
{
	shouldStop = true;
}

async function StartGames()
{
	debugger;
	hasWon = false;
	gamecount = 0;
	shouldStop = false;
	totalFlipsForAverage = 0;
	netProfit = 0;
	
	let betAmount = parseFloat(document.getElementById('betAmount').value);

	while((!hasWon || (hasWon && !document.getElementById('stopOnWin').checked)) && !shouldStop)
	{
			gamecount++;
			document.getElementById('numGames').innerText = gamecount;
			document.getElementById('averageFlips').innerText = totalFlipsForAverage / gamecount;
			
			try
			{			
				while(!c_cfg.state.isBetting && !shouldStop)
				{
					c_cfg.handleBet(new c_decimal(betAmount));
					await delayAsync(300);
				}
				netProfit -= betAmount;
				await DoFlips();
				document.getElementById('netProfit').innerText = netProfit;
			}
			catch(ex)
			{
				console.log(ex.toString());
			}
	}
}

async function DoFlips()
{	
	let numberOfFlips = parseInt(document.getElementById('numFlips').value);
	let gamePlayType = document.getElementById('playType').value;
	document.getElementById('currentResults').innerText = "";

	while(!shouldStop)
	{		
		document.getElementById('numGames').innerText = gamecount;		
		
		let previousGuess = 0;
		let nextGuess = 0;
		
		while(!shouldStop && (c_cfg.state.guessing || c_cfg.canGuess())&& c_cfg.state.betrounds.length < numberOfFlips)
		{
			if(mostFlips <= c_cfg.state.betrounds.length)
			{
				mostFlips = c_cfg.state.betrounds.length;
				document.getElementById('mostFlips').innerText = mostFlips;
			}
			
			await c_cfg.handleNext(nextGuess);
			let currentResults = document.getElementById('currentResults').innerText + nextGuess.toString();
			document.getElementById('currentResults').innerText = currentResults;
			document.getElementById('currentFlips').innerText = c_cfg.state.betrounds.length;
			await delayAsync(10);
		}
		
		if(c_cfg.state.guessing || c_cfg.canGuess())
		{
			await c_cfg.cashout();
			PlayWinSound();
			netProfit += c_cfg.state.resultInfo.winAmount;
			hasWon = true;
			totalFlipsForAverage += c_cfg.state.betrounds.length;
			return;
		}
		else
		{
		 // no need to do anything here unless you wanted to record the loss
			totalFlipsForAverage += c_cfg.state.betrounds.length - 1;
			return;
		}
	}
}

function delayAsync(timeMs)
{
    return new Promise(function (resolve)
    {
        setTimeout(resolve, timeMs);
    });
}

function GetRandomInt(min, max) {
    var retValue = Math.floor(Math.random() * (max - min)) + min;

    return retValue;
}

You will have to use the source tab on the developer console to figure out the files to import.  And those files will change whenever there is an update but it will allow you to resue scripts that were using the object model that was easy to access before they put everything into modules.  You can technically also wire up the UI to the new object that you created and control in this scenario but i didn't want to spend the time to do so and since the outcome was all i cared about.

Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...