SRL Archive - S.M.A.R.T. General and Q/A.

The 'Enter' Key ?


Sp0rky

2007-11-22 21:45:07

Well, I've heard it mentioned before but can't seem to find it.

Just tried to use TypeSend to get some items of my bank, and it doesn't hit enter?

Do I have to edit typesend? If so, what to?

Help would be greatly appreciated.

HyperSecret

2007-11-22 21:48:15

in smart.scar under Sendkeys put if (key = 13) then (key = 10) the enter key in java is 10 not 13 :D

Sp0rky

2007-11-22 21:59:56

Tyvm.

The Un-Named

2007-11-22 22:07:48

From: HyperSecret
in smart.scar under Sendkeys put if (key = 13) then (key = 10) the enter key in java is 10 not 13 :D


Not so Char 10 is actually "new line", while Char 13 is "return". Since we don't have a "new line" key on our keyboard, we use return so in SCAR, we use Char 13 not 10. However, SMART doesn't work like SCAR, so you need to use Char 10 not 13.

Bobarkinator

2007-11-23 23:52:31

http://www.srl-forums.com/forum/showpost.php?p=276320&postcount=12

Change your typesend to that, it will work.

Sp0rky

2007-12-02 22:37:07

Unfortunately, none of the above fixes the pressing enter problem in smart. Really appreciate you trying though.

The Claw

2007-12-02 22:51:24

Very strange, post up your smart.scar and i'll take a look

Psychor

2007-12-05 08:24:03

From: HyperSecret
in smart.scar under Sendkeys put if (key = 13) then (key = 10) the enter key in java is 10 not 13 :D


When i do that i get
Line 46: [Error] (49:5): Unknown identifier 'key' in script C:\Program Files\SCAR 3.12\includes\SRL/SRL/misc/smart.scar

Markus

2007-12-05 09:07:34

Replace KeyDown and KeyUp with this:

procedure KeyUp(key: Byte);
begin
if (key = 13) then key := 10;
SmartReleaseKey(key);
end;

procedure KeyDown(key: Byte);
begin
if (key = 13) then key := 10;
SmartHoldKey(key);
end;

Sp0rky

2007-12-05 10:52:59

Awesome markus, fixed it. Thank you.

TheGuyWhoGotOn

2007-12-24 11:53:28

From: Markus
Replace KeyDown and KeyUp with this:

procedure KeyUp(key: Byte);
begin
if (key = 13) then key := 10;
SmartReleaseKey(key);
end;

procedure KeyDown(key: Byte);
begin
if (key = 13) then key := 10;
SmartHoldKey(key);
end;


Shouldn't that be included with SMART.scar?

BTW: Sorry for bumping this but it was annoying for me to try and fix this as well.

nielsie95

2007-12-24 12:40:45

Yup, should be in Smart.scar.

TheGuyWhoGotOn

2007-12-24 13:45:36

From: nielsie95
Yup, should be in Smart.scar.


So who should I PM this topic to to get this added, Fakawi?

nielsie95

2007-12-24 13:56:52

SMART.scar isn't included in SRL. Just add it in your own version.

TheGuyWhoGotOn

2007-12-24 14:04:04

From: nielsie95
SMART.scar isn't included in SRL. Just add it in your own version.


Well other SRL Members could get this problem and SMART will be released to non-members one day so this might as well be fixed. At least I'm pretty sure they've been saying it will be released to non-members.

Well I guess I'll just leave it for now then.

richk1693

2008-01-02 00:56:18

Sorta grave dig, but I'm having the exact same problem, and none of these fixes helped.

TheGuyWhoGotOn

2008-01-02 01:08:04

From: Markus
Replace KeyDown and KeyUp with this:

procedure KeyUp(key: Byte);
begin
if (key = 13) then key := 10;
SmartReleaseKey(key);
end;

procedure KeyDown(key: Byte);
begin
if (key = 13) then key := 10;
SmartHoldKey(key);
end;


Really? That didn't work? Are you sure you did it right?

richk1693

2008-01-02 11:53:25

I replaced it in smart.scar. Was I supposed to find the actual SRL function or was I supposed to do it in smart.scar?

FrÕzÑ_§ÕµL

2008-01-02 14:18:07

Uh well it works fine if you edit Text.scar to this:
procedure TypeSend(Text: string);
var
i: Integer;
Shift: Boolean;
begin
{$IfDef SMART}
Shift:= True;
i:= 0;
SmartSendKeys(Text + Chr(10));
{$Else}
for i := 1 to Length(Text) do
begin
Shift := (Text[i] = ':') or (Text[i] = '!') or (Text[i] = '+') or
(Text[i] = '?') or (Text[i] = '<') or (Text[i] = '>') or
(Text[i] = '@') or (Text[i] = '#') or (Text[i] = '$') or
(Text[i] = '&') or (Text[i] = '%') or (Text[i] = '*');
if (Text[i] = '_') then
Text[i]:= ' ';
if (Shift) then
begin
KeyDown(VK_Shift);
Wait(5 + Random(20));
end;
TypeByte(GetKeyCode(Text[i]));
if (Shift) then
begin
KeyUp(VK_Shift);
Wait(5 + Random(20));
end;
Wait(50 + Random(120));
end;
Wait(200 + Random(500));
TypeByte(13);
{$EndIf}
end;
Only use that if you are modifying the SRL include using {IfDef} as well.

richk1693

2008-01-02 20:33:06

Let's see if we can't fix this.

My current TypeSend.
procedure TypeSend(Text: string);
var
i: Integer;
Shift: Boolean;
begin
{$IfDef SMART}
Shift:= True;
i:= 0;
SmartSendKeys(Text + Chr(10));
{$Else}
for i := 1 to Length(Text) do
begin
Shift := (Text[i] = ':') or (Text[i] = '!') or (Text[i] = '+') or
(Text[i] = '?') or (Text[i] = '<') or (Text[i] = '>') or
(Text[i] = '@') or (Text[i] = '#') or (Text[i] = '$') or
(Text[i] = '&') or (Text[i] = '%') or (Text[i] = '*');
if (Text[i] = '_') then
Text[i]:= ' ';
if (Shift) then
begin
KeyDown(VK_Shift);
Wait(5 + Random(20));
end;
TypeByte(GetKeyCode(Text[i]));
if (Shift) then
begin
KeyUp(VK_Shift);
Wait(5 + Random(20));
end;
Wait(50 + Random(120));
end;
Wait(200 + Random(500));
TypeByte(13);
{$EndIf}
end;

my SRL.scar
//----------------------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//----------------------------------------------------------------------------//
//-- by: Azeroth, Bebemycat2, BenLand100, benleegt, Boreas, c0de, --//
//-- Cheesehunk, Dankness, driger1592, Flyboy, Freddy1990, --//
//-- inferno, Kernel Klink, Knightstreak, Krazy_Meerkat, Krichevskoy, --//
//-- Lorax, Mad Cow, masquerader, moparisthebest, Mutant Squirrle, --//
//-- nielsie95, phantombmx, pups, Pyro, realrune, Renax, Ron, RsN, --//
//-- Solemn wishes, Spky, SRL, Starblaster100, Stupid3ooo, Sumilion, --//
//-- tarajunky, Wizzup?, WT-Fakawi, XxKanexX, Yakman, _ChArMz....... --//
//-- --//
//-- ....... and the SRL Community. --//
//----------------------------------------------------------------------------//


//----------------------------------------------------------------------------//
// -- SRL Level 1 Includes --//
// -- --//
// -- Low Level SCAR Math, Mouse Movement and Color Clicking routines. --//
//----------------------------------------------------------------------------//

{.include SRL/SRL/Core/Globals.scar}
{.include SRL/SRL/Core/Math.scar}
{.include SRL/SRL/Core/Mouse.scar}
{.include SRL/SRL/Core/Color.scar}
{.include SRL/SRL/Core/Players.scar}

//----------------------------------------------------------------------------//
// -- SRL Level 2 Includes --//
// -- --//
// -- Interface, Object and OCR routines. --//
//----------------------------------------------------------------------------//

{.include SRL/SRL/Core/Timing.scar}
{.include SRL/SRL/Core/GameTab.scar}
{.include SRL/SRL/Core/Text.scar}
{.include SRL/SRL/Core/Inventory.scar}
{.include SRL/SRL/Core/Object.scar}

//----------------------------------------------------------------------------//
// -- SRL Level 3 Includes --//
// -- --//
// -- MapWalking, AntiRandoms, Bank, Symbol and many more... --//
//----------------------------------------------------------------------------//

{.include SRL/SRL/Core/FlagChat.scar}
{.include SRL/SRL/Core/Login.scar}
{.include SRL/SRL/Core/Mapwalk.scar}
{.include SRL/SRL/Core/Bitmap.scar}
{.include SRL/SRL/Core/DTM.scar}
{.include SRL/SRL/Core/Bank.scar}
{.include SRL/SRL/Core/DoorProfiles.scar}
{.include SRL/SRL/Core/Symbol.scar}
{.include SRL/SRL/Core/RC.scar}
{.include SRL/SRL/Core/AutoColor.scar}
{.include SRL/SRL/Core/AntiRandoms/Common.scar}
{.include SRL/SRL/Core/Globalstats.scar}
{.include SRL/SRL/Core/Setup.scar}
{.include SRL/SRL/Core/CAutoRespond.scar}
{.include SRL/SRL/Core/AntiRandoms/Box.scar}
{.include SRL/SRL/Core/AntiRandoms/Certer.scar}
{.include SRL/SRL/Core/AntiRandoms/Demon.scar}
{.include SRL/SRL/Core/AntiRandoms/Frog.scar}
{.include SRL/SRL/Core/AntiRandoms/Quiz.scar}
{.include SRL/SRL/Core/AntiRandoms/Sandwich.scar}
{.include SRL/SRL/Core/AntiRandoms/EvilBob.scar}
{.include SRL/SRL/Core/AntiRandoms/ChatRandoms.scar}
{.include SRL/SRL/Core/AntiRandoms/AntiRandoms.scar}
{.include SRL/SRL/Core/AntiBan.scar}
{.include SRL/SRL/Core/Amount.scar}
{.include SRL/SRL/Core/Users.scar}

{*******************************************************************************
procedure SetupSRL;
by: SRL Dev Team
Description: Sets up all variables needed to run SRL.
*******************************************************************************}

procedure SetupSRL;
begin
{$IFDEF SMART}
SmartSetup('ams3', False, false);
wait(10000+random(5000));
SetTargetDC(SmartGetDC);
repeat
wait(100);
until(SmartGetColor(253, 233)<>1118604);
{$ENDIF}
MouseSpeed := 15;
NickNameBMP := 0;
CheckHPFirst := True;
Reincarnate := False;
TalkAfterRandoms := False;
RoadColor := 0;
WaterColor := 0;
BankColor := 0;
LampSkill := 'prayer';
SetUpSRLReport;
SetMouseMode(false);
LoadCosineArrays;
SymbolAccuracy:= 0.8;
LoadNPCArray;
LoadSRLBitMaps;
SolveChatRandoms := True;
SetupSRLAutoResponder
UseSandWichSolver := True;
UseBoxSolver := True;
UseCerterSolver := True;
UseFindmod := True;
UseFindtrade := True;
Screenshots := False;
TheFile := RewriteFile(AppPath + 'ChatLog.txt', False);
Writeln ('SRL Compiled in '+ IntToStr(GetTimeRunning) + ' msec');
end;

my Smart.scar
{$DEFINE SMART}
procedure MoveMouse(x, y: Integer);
begin
SmartMoveMouse(x, y);
end;

procedure HoldMouse(x, y: Integer; left: Boolean);
begin
SmartHoldMouse(x, y, left);
end;

procedure ReleaseMouse(x, y: Integer; left: Boolean);
begin
SmartReleaseMouse(x, y, left);
end;

procedure KeyUp(key: Byte);
begin
if (key = 13) then key := 10;
SmartReleaseKey(key);
end;

procedure KeyDown(key: Byte);
begin
if (key = 13) then key := 10;
SmartHoldKey(key);
end;

procedure SendKeys(S: String);
begin
if (key = 13) then key := 10;
SmartSendKeys(S);
end;

procedure GetMousePos(var x, y: Integer);
begin
SmartGetMousePos(x, y);
end;

function GetColor(x, y: Integer): Integer;
begin
result:= SmartGetColor(x, y);
end;

procedure SmartSetTarget;
var
Smart_Bitmap: Integer;
begin
Smart_Bitmap:= BitmapFromString(765,503,'');
GetBitmapCanvas(Smart_Bitmap).Handle:= SmartGetDC;
SetTargetBitmap(Smart_Bitmap);
FreeBitmap(Smart_Bitmap);
end;

function FindWindow(Title: String): Boolean;
begin
result:= true;
end;

procedure ActivateClient;
begin
end;

function FindWindowBySize(Width, Height: Integer): Boolean;
begin
result:= true;
end;

Using script : Variable Yew Cutter.


I have every fix I've found in these. If one contradicts another and that's my problem someone should be able to tell me now. Thanks for any help anyone can give me, and tell me if there's anything else you may need to see / know.

TheGuyWhoGotOn

2008-01-03 11:00:01

Wow that sucks…You have SRL.scar and SMART.scar setup right. I don't see a point in changing TypeSend…If it's still not working for you…I have no clue at all.

richk1693

2008-01-03 12:45:18

Oh well. Thanks for trying so hard to thelp me. I'll keep screwing with it and see if I can get anything.

TheGuyWhoGotOn

2008-01-03 12:47:55

Do any other scripts work? And maybe you can try removing your SCAR folder, re-installing SCAR, re-download SRL, re-setup SMART, and maybe that will work.

richk1693

2008-01-03 12:52:38

That's what I'm currently doing. I'll edit this post and let ya know how that went.

No luck. Auto responding is for nubz anyways.

TheGuyWhoGotOn

2008-01-03 12:56:24

From: richk1693
That's what I'm currently doing. I'll edit this post and let ya know how that went.


Ok, I hope you get all this sorted out.