PDA

View Full Version : [Utility] Simba(or Slushpuppy ^.^) Sound Library



slushpuppy
10-26-2012, 01:57 PM
Simba Sound Library

This is an addon tool designed to aid developers in adding realism to their scripts.

In Runescape, any activity performed by your character is accompanied by a distinct sound feedback. By capturing this feedback, you can accurately determine if your character is doing a particular task.

By using sound and color, scripts can be more accurate, realistic and productive.


I do plan to add sound waves matching in the future-when real life grants me such opportunity



Users:

Setup runescape account and your sound mixer as described:
http://i.imgur.com/ckX4t.png

Download the soundlib.zip attached to this topic and extract, then save it to C:\Simba\Plugins




Developers:



API:


{

SSL_init(PID : Integer,Interval : Integer);

This procedure initiates the library. This function can only be called after SetupSRL.

- PID : Process ID of java.exe which can be retrieved from Smart_CurrentClient integer

- Interval : The time period, in milliseconds, which the library tries to capture sound.

}

SSL_hasSound : Boolean;

This function checks for the presence of sound data from PID. Returns True/False




How to use this library in your scripts


{$DEFINE SMART}
{$DEFINE SMART8}

{$I SRL/SRL.Simba}
{$loadlib soundlib.dll}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
WorldInfo := [27, 42, 45, 46, 48, 52, 59, 70, 72, 78, 79, 87, 104, 115, 117];
BoxRewards := ['XP','xp','lamp'];
LampSkill := Skill_Slayer;
Active := True;
end;
end;

begin
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 72;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}

DeclarePlayers;
SetupSRL;
SSL_init(Smart_CurrentClient,400);
repeat
begin
sleep(1000);
writeln(booltostr(SSL_hasSound));
end
until(false);
end.


Test run


Ddtu0IJVUdA

Example script:
http://villavu.com/forum/showthread.php?p=1117705#post1117705

The Killer
10-26-2012, 02:43 PM
nice, People mention this every now and then but it was never made (that I know of)

P1ng
10-27-2012, 01:53 AM
Really cool little utility, definitely going to test this out when I next have a chance to write a script :)

Ashaman88
10-27-2012, 03:46 PM
Very nice! Will definitely play around with it in the future!

DaWu
11-13-2012, 05:32 AM
For this to actually kick in on widescale use, you either need:
1. a SMART function that sets the volume to 1% that scripters may call in their scripts.
2. a way to pull the sound without it actually reaching the speakers.

Im pretty sure people are too lazy to manually set the volume to that 1% and no one wishes to hear clicks and clacks, especially if people run multiple bots simultaneously, not to mention it has to be set to 1% again once SMART reloads after 6 hours.

I like the concept of using the sounds tho, its something that can be very helpful in many cases.

Ian
11-13-2012, 05:39 AM
If anyone has gotten this working in their scripts could they tell me how? I read the instructions and set it up correctly, but It always reports there to be sound even when there's not :(

Here's the code if anyone's curious:
program RatKilla;

{$Define smart}
{$i srl/srl.simba}
{$I SRL/srl/skill/fighting.Simba}
{$i sps/sps.simba}
{$loadlib soundlib.dll}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
LampSkill := Skill_Attack;
Active := True;
end;
end;


Var
Kills, Bones, Deaths: Integer;

procedure StartLogin;

begin
ClearDebug;
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
DeclarePlayers;
LoginPlayer;
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
SetChat('hide', 1);
end;

Procedure WalkToRats;
Var
WalkToGiantRats:TPointArray;

begin
if not LoggedIn then LoginPlayer;
SPS_Setup(RUNESCAPE_SURFACE,['11_8','11_9']);
WalkToGiantRats := [Point(4717, 3562), Point(4687, 3620), Point(4659, 3629), Point(4593, 3629), Point(4567, 3605)];
SPS_WalkPath(WalkToGiantRats)
MakeCompass('S');
end;

procedure Antiban;
Var
WalkBack:TPointArray;
begin
if not LoggedIn then LoginPlayer;
FindNormalRandoms;
case Random(90) of
0..9: RadialWalkTolerance(63487,0,359,25,5,5,2);
2: PickUpMouse;
3: PickUpMouse;
4: BoredHuman;
5: HoverSkill(skill_prayer,false);
6: MakeCompass('N');
7: SetAngle(SRL_ANGLE_HIGH);
8: Wait(5000+random(2000));
9: HoverSkill(skill_attack,false);
end;
end;

Function IsFighting : Boolean;

begin
Result := SSL_hasSound;
end;

Procedure KillRats;
Var
x, y: Integer;
begin
if not LoggedIn then LoginPlayer;
FindNormalRandoms;
If (not InFight) Then
begin
If FindObjCustom(x, y, ['Rat', 'at'], [4605769, 3882302], 5) Then
begin
ClickMouse2(false);
WaitOption('nt', 2000);
Wait(100);
If IsFighting then
begin
WriteLn('Fighting Rat')
Kills := Kills + 1
Wait(randomrange(800,1200));
Repeat
Antiban;
Wait(randomrange(100,200));
Until(not SRL_infight)
end;
Flag;
Wait(randomrange(800,1200));
end;
end;
end;

Procedure GetBones;
Var
x, y: Integer;
begin
if not LoggedIn then LoginPlayer;
FindNormalRandoms;
If (not InFight) Then
begin
If FindObjCustom(x, y, ['take', 'Raw', 'ones'], [12567240], 3) Then
Begin
WriteLn('Bones Located')
GetMousePos(x, y);
Mouse(x, y, 1, 1, false);
Antiban;
WaitOption('ones', 500);
Flag;
end;
end;
end;

Procedure BuryBones;
var
l, m, Bone: Integer;
begin
if not LoggedIn then LoginPlayer;
If (not InFight) Then
Repeat
Bone := DTMFromString('mbQAAAHicY2VgYIhiYmAIA+JUIA4B4iAgXs bIwLCBEUIvgNJdLS1A1Uwo+D8DJmDEgsEAAD57B7A=');

If FindDTM(Bone, l, m, MIX1, MIY1, MIX2, MIY2) Then
begin
FindNormalRandoms;
Case Random(20) Of
0..18: Mouse(l, m, 10, 10, true);
19: begin
Mouse(l, m, 10, 10, true);
HoverSkill(skill_Prayer, False);
WriteLn('Antiban: Prayer XP Check Performed');
end;
20: MissMouse(l+random(400),m+random(400));
end;
Bones := Bones + 1
wait(randomrange(1500,1900));
end;
FreeDTM(Bone);
Until(InvEmpty);
end;

Procedure InvCheck;

begin
if not LoggedIn then LoginPlayer;
If(InvFull) and (not InFight) Then
begin
BuryBones;
end else
exit;
end;

Procedure DeathCheck;

begin
Reincarnate:=true;
if not LoggedIn then LoginPlayer;
If(FindDead) Then
begin
Deaths := Deaths + 1
WriteLn('You died. Returning to rats..');
MouseItem(2, mouse_left);
MouseItem(3, mouse_left);
MouseItem(4, mouse_left);
MouseItem(6, mouse_left);
MouseItem(5, mouse_left);
MouseItem(1, mouse_left);
WalkToRats;
end else
exit;
end;


procedure Proggy;
var
KillsPH, DeathsPH, CombatXPPH:Integer;

begin
if not LoggedIn then LoginPlayer;
wait(100);
KillsPH := Round((Kills * 3600) / (GetTimeRunning / 1000));
DeathsPH := Round((Deaths * 3600) / (GetTimeRunning / 1000));
CombatXPPH := Round(((Kills * 27) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('~~~~~Rat Killer V1.0~~~~~');
Writeln(' ~By BMWxi~ ');
Writeln(' Rats Killed: ' + IntToStr(Kills) + ' (' + IntToStr(KillsPH) + ' P/H)');
Writeln(' Deaths: ' + IntToStr(Deaths) + ' (' + IntToStr(DeathsPH) + ' P/H)');
Writeln(' CombatXP earned: ' + IntToStr(Kills * 20) + ' (' + IntToStr(CombatXPPH) + ' P/H)');
Writeln(' Total Time: ' + TimeRunning);
Writeln('~~~~~~~~~~~~~~~~~~~~~~~~~');
end;

begin
SetupSRL;
DeclarePlayers;
SSL_init(Smart_CurrentClient,400);
StartLogin;
Repeat
KillRats;
DeathCheck;
Proggy
Until(not LoggedIn);
end.

Olly
11-13-2012, 05:44 AM
For this to actually kick in on widescale use, you either need:
1. a SMART function that sets the volume to 1% that scripters may call in their scripts.
2. a way to pull the sound without it actually reaching the speakers.

Im pretty sure people are too lazy to manually set the volume to that 1% and no one wishes to hear clicks and clacks, especially if people run multiple bots simultaneously, not to mention it has to be set to 1% again once SMART reloads after 6 hours.

I like the concept of using the sounds tho, its something that can be very helpful in many cases.

I couldn't agree more, this is great but it has soo much more potential ;)

slushpuppy
11-14-2012, 12:17 PM
For this to actually kick in on widescale use, you either need:
1. a SMART function that sets the volume to 1% that scripters may call in their scripts.
2. a way to pull the sound without it actually reaching the speakers.

Im pretty sure people are too lazy to manually set the volume to that 1% and no one wishes to hear clicks and clacks, especially if people run multiple bots simultaneously, not to mention it has to be set to 1% again once SMART reloads after 6 hours.

I like the concept of using the sounds tho, its something that can be very helpful in many cases.

2. I opted to use existing win32 hooks to retrieve sound data as they are easier than trying to inject into the windows sound layer stack. With that said, I still have that planned in the future.


By setting your sound to 1%, you will not hear anything unless you are superman. Also those sound settings preserve between runescape and windows sessions

DaWu
11-15-2012, 01:58 AM
2. I opted to use existing win32 hooks to retrieve sound data as they are easier than trying to inject into the windows sound layer stack. With that said, I still have that planned in the future.


By setting your sound to 1%, you will not hear anything unless you are superman. Also those sound settings preserve between runescape and windows sessions

Sadly with the sound settings @ original post, I can hear the chopping sounds for example, clear as day.

Ian
11-15-2012, 02:01 AM
Sadly with the sound settings @ original post, I can hear the chopping sounds for example, clear as day.

For me I don't hear them, but it always thinks there is sound even if I'm standing still (with the settings correct too)

DaWu
11-15-2012, 02:04 AM
Actually, it seems like this works perfectly fine with even lower effect sound level set in runescape (in OP its nowhere near minimum)

Ian
11-15-2012, 02:05 AM
Actually, it seems like this works perfectly fine with even lower effect sound level set in runescape (in OP its nowhere near minimum)

That could be the problem, thanks!

DaWu
11-15-2012, 02:19 AM
That could be the problem, thanks!

The problem with your script is that you are calling the sound check way too early. Make it wait for the sound to show up for like 5 seconds before declaring it nonexistant. You call the soundcheck 100ms after you've clicked the monsters, theres a good chance you haven't even reached the monster yet not to mention sound to be registered by the plugin.

Ian
11-15-2012, 02:46 AM
The problem with your script is that you are calling the sound check way too early. Make it wait for the sound to show up for like 5 seconds before declaring it nonexistant. You call the soundcheck 100ms after you've clicked the monsters, theres a good chance you haven't even reached the monster yet not to mention sound to be registered by the plugin.

Oh, whoops :redface:

I'm using putonajonny's hitsplat detection method right now though, it is probably just as accurate.

xdarkshadowx
01-09-2013, 02:44 AM
Will I be able to use this on a non-RS script?

bud_wis_er_420
02-11-2013, 09:32 PM
Very interesting. I've heard this talked about b4, but never seen it done. I would definitely think this would be a very valuable tool to progress further. I'm surprised to see this hasn't been developed and implemented into srl years ago. And even now, after slushpuppy got it started no one is trying to take it further. I will attempt to test it in the near future.

Flight
10-14-2013, 03:43 AM
slushpuppy: Have you updated this recently? I'd like to use it in Simba 1.0. Also, do you have plans in the future to have this plugin return the exact ID of the current sound playing (if any)? As said above, this has potential...

slushpuppy
10-14-2013, 01:36 PM
slushpuppy: Have you updated this recently? I'd like to use it in Simba 1.0. Also, do you have plans in the future to have this plugin return the exact ID of the current sound playing (if any)? As said above, this has potential...

I will work on this after I finish my opencv plugin for rs3

Flight
10-14-2013, 03:00 PM
I will work on this after I finish my opencv plugin for rs3

Awesome, then I'll keep a close eye on this thread. Make a post when you've updated it or drop me a line.