SRL Archive - General

A standard way of macro typing, please read on


NxTitle

2009-07-13 19:19:39

Okay, I have noticed that scar (and just about every macroer out there, RS or not) doesn't have any really good format for typing out strings. I mean, we have SendKeysVB, however everyone knows that this format absolutely sucks and you cannot do anything useful with it.

What I wanted was something that was simple, yet powerful enough to handle absolutely any problem, regardless of anything. The format I have created is very promising.

Everything under this line has actually been implemented into my code. Look below for a pastebin link.

First, let's say you just wanted to type out a simple string? Let's say the string was "runescape is awesome and i am not a cheater". Well, that is simple and can be done by anything out there.
Some problems come in when you bring capitals into it, such as "RuneScape is AWESOME and I am not a cheater". This part is still simple, you just have the macro hold down shift for every capital letter.
The third problem is with punctuation, such as an obligatory period at the end of that sentence ("RuneScape is AWESOME and I am not a cheater.") The way that the windows input commands work makes this almost impossible because the virtual keys do not map to ASCII (For an example, "." maps to 0xBE under windows virtual keys, however in ASCII it is actually 0x2E, a huge difference). It unfortunately isn't a matter of simply shifting the numbers down or up because they are not in order.
My code (found at the bottom) is able to handle all of these, and plenty more.

Let's say you wanted to use a shortcut that needed to use the CTRL key. Well, with the above examples that wouldn't work at all! That's where my next solution comes in. If you wanted to press, for example, CTRL+C, well you can simply input the string "[CTRL]c[/CTRL]" and it will do just that. You can even combine them, for example "[CTRL][ALT][SHIFT]A[/SHIFT[[/ALT][/CTRL]" (I don't know what that would do, however it would be pretty interesting.)

Everything below this line is not actually implemented in my code however I believe they should be part of the macrotype, well, "standard".
One possible problem with the special keys (keys enclosed in a [] tag) is that someone might just want to press a key and not combine it with anything, say maybe they only want to press the [F2] key and not have to use "[F2][/F2]". Well one way to make the strings look better would be to give another tag. my choice is "<F2>" so it will act just like any key. so with this you could do "[CTRL][ALT]<DELETE>[/ALT][/CTRL]" (however please don't do this, it'll make you look bad ;) ).

Now you've probably noticed I am missing the one really important thing in any macroing program: randomness. Well never fear, as I have my next solution: mini functions. say you wanted a delay of about 1 second between two sentences. In this case, we can do "This is one sentence.{delay: 1000ms}This is another sentence.". We can also use the syntax of {delay: 1s} to make things easier. This will allow any program to generate their own random numbers and input them as so. However why not put it directly into the syntax? "This is one sentence.{delay: 1s}{rdelay: 20ms}This is another sentence."

Using these 3 tags shown above this syntax can have endless possibilities. Please discuss what you think about this idea, as I think it has great potential, and will make the job of scripting much much easier.


Here's what you were looking for - my code!
http://p.talkflack.com/index.php/view/63251790
I am not putting any restrictions at all on this code or any macrotype code I make in the future. You are allowed to make your implementation proprietary if you really want, however I am keeping the description of the format completely open. Essentially everything I do related to macrotype is released into public domain.

Da 0wner

2009-07-13 19:23:00

KeyDown(VK_CONTROL);
Wait(30 + random(30));
TypeByte(GetKeyCode('v'));
Wait(30 + random(30));
KeyUp(VK_CONTROL);
??

NxTitle

2009-07-13 19:50:24

From: Da 0wner
Code:
[LEFT]KeyDown(VK_CONTROL);
Wait(30 + random(30));
TypeByte(GetKeyCode('v'));
Wait(30 + random(30));
KeyUp(VK_CONTROL);
[/LEFT]

??


The equivalent command in macrotype would be macrotype("[CTRL]{rdelay:30ms}v{rdelay:30ms}[/CTRL]",30);
isn't that so much simpler?

Da 0wner

2009-07-13 20:00:26

Sure. Could be replicated in SCAR though…

NxTitle

2009-07-13 20:19:31

From: Da 0wner
Sure. Could be replicated in SCAR though…

definitely, however this makes it simpler and cleaner. And because it's written in C, it can be made into a DLL and used with scar which would create something much much faster than your code.

Baked0420

2009-07-13 21:12:34

I think the scar looks better, I don't like the way you had to write it in C, but I do really like your idea, good job, you should definitely finish this.

Gu3st...

2009-07-13 23:38:34

I think this is brilliant! Awesome idea! :)
NxTitle, have you made this function in scar yet?

ShowerThoughts

2009-07-13 23:47:06

From: Zyt3x
I think this is brilliant! Awesome idea! :)
NxTitle, have you made this function in scar yet?


Same!
This is genious!
<3, I think this is very smart.
When are you going to add the second part?

I didn't give the code a look already, but can you implant this in scar(ask freddy1990).

Griff

2009-07-13 23:57:40

From: Zyt3x
I think this is brilliant! Awesome idea! :)
NxTitle, have you made this function in scar yet?


I think it's a great idea too, and should be added to scar.

NxTitle

2009-07-14 01:44:05

I have posted it on Freddy1990's forum and there has been no reply (although it's only been there for like an hour so I don't expect him to so quickly)

I really hope that Freddy can implement something like this into SCAR, however if he doesn't accept then I can always make it into a DLL and distribute it.

Home

2009-07-14 01:53:23

From: NxTitle
I have posted it on Freddy1990's forum and there has been no reply (although it's only been there for like an hour so I don't expect him to so quickly)

I really hope that Freddy can implement something like this into SCAR, however if he doesn't accept then I can always make it into a DLL and distribute it.


Blah i feel so stupid ( Probaly because my lack of English ) But i didn't understand : /
Could you make simple little explanation :)

~Home

Nadeem

2009-07-14 05:58:52

I have already made a similar function like this :) I'll post it for you guys when I get home.



~NS

NxTitle

2009-07-14 07:27:22

From: Home
Blah i feel so stupid ( Probaly because my lack of English ) But i didn't understand : /
Could you make simple little explanation :)

~Home


Don't worry, I know I made that really wordy. Someone else even said tl;dr for it, lol.

Okay, so basically it lets you send a string of keys to runescape.
it ranges from as simple as "This is rs." to "[SHIFT]t[/SHIFT]his is {delay:20ms} rs."
or even things like "[CTRL][ALT]<DELETE>[/ALT][/CTRL]"

the way the syntax works is this:
anything not in a tag ( tags are enclosed in [], {} or <> ) will be typed the way it is seen.
anything in [] tags are keydown or keyup. For example, typing [CTRL] will push the CTRL key down, and [/CTRL] will release it again.
anything in <> tags are special keys that are just pressed. For example, <CTRL> will press CTRL then release it, just like it was any other key.
anything in {} is a mini function. Basically I wanted to put this in for custom delays. The two functions I have planned for this are "delay" and "rdelay". delay just sleeps for the amount of time given, and rdelay sleeps for a random amount between the amount of time given and 0ms so you can combine them as well. For example, if you wanted a random amount between 30ms and 60ms, you can do "{delay:30ms}{rdelay:30ms}"

hopefully that helped.

marpis

2009-07-14 08:13:48

I think it's a major drawback in SRL not to be able to write those special chars.
If this works as you say, it definetly should be added to SRL.

Can't the randomness be handled like
TypeThis('Hi, my name is Bob!.,#', 200+random(100));
like in pascal

Da 0wner

2009-07-14 08:43:54

I wrote this in SCAR, a simple and crappy version :p.

Nadeem

2009-07-14 10:35:21

From: Da 0wner
I wrote this in SCAR, a simple and crappy version :p.


lol yea, I have a kinda simple one too, as I've said, I'll post it as soon as I get home, like by tomorrow or something. The one I made is used like this:


TypeSmart('<wait>$n</wait><shift>$n</shift>$n<space/>$n', [2000, 'H', 'i, testing', 'spaced!'])

:)



~NS

Gu3st...

2009-07-14 13:55:56

From: marpis
Can't the randomness be handled like
TypeThis('Hi, my name is Bob!.,#', 200+random(100));
like in pascal
The script would not be able to know where the wait should be added, and what if you wanted to wait in two different periods?

Home

2009-07-14 18:19:42

From: NxTitle
Don't worry, I know I made that really wordy. Someone else even said tl;dr for it, lol.

Okay, so basically it lets you send a string of keys to runescape.
it ranges from as simple as "This is rs." to "[SHIFT]t[/SHIFT]his is {delay:20ms} rs."
or even things like "[CTRL][ALT]<DELETE>[/ALT][/CTRL]"

the way the syntax works is this:
anything not in a tag ( tags are enclosed in [], {} or <> ) will be typed the way it is seen.
anything in [] tags are keydown or keyup. For example, typing [CTRL] will push the CTRL key down, and [/CTRL] will release it again.
anything in <> tags are special keys that are just pressed. For example, <CTRL> will press CTRL then release it, just like it was any other key.
anything in {} is a mini function. Basically I wanted to put this in for custom delays. The two functions I have planned for this are "delay" and "rdelay". delay just sleeps for the amount of time given, and rdelay sleeps for a random amount between the amount of time given and 0ms so you can combine them as well. For example, if you wanted a random amount between 30ms and 60ms, you can do "{delay:30ms}{rdelay:30ms}"

hopefully that helped.


Yes! Now i got it! And i think this is a great addition to scar! :)

~Home

P.S Good Job!

NxTitle

2009-07-14 23:13:12

From: marpis
I think it's a major drawback in SRL not to be able to write those special chars.
If this works as you say, it definetly should be added to SRL.

Can't the randomness be handled like
TypeThis('Hi, my name is Bob!.,#', 200+random(100));
like in pascal


that wouldn't end up the way you would want it to. So I had an idea for that.

first, we could have a second parameter for the randomness, such as
macrotype("Hi, my name is Bob!.,#',200,100)
or -1 for no randomness.

I just didn't want to put it into C because it is notorious for having a really shitty random number generator.

And yes, it supports every symbol on my keyboard, which is a US layout. I would need more people from different places to add in the british pound and euro symbols, etc.

Freddy1990

2009-07-16 06:06:04

From: marpis
I think it's a major drawback in SRL not to be able to write those special chars.
If this works as you say, it definetly should be added to SRL.


I'm working on a sendkeys function that can send special characters… Also going to write one to do what this one does, i like the idea :)

Daniel

2009-07-16 08:21:43

http://delphi.about.com/od/adptips2004/a/bltip0604_4.htm

:p

And just use PostKeyEx32 just a normal KeyDown & KeyUp :)

Freddy1990

2009-07-16 13:15:41

[QUOTE=Dan's The Man;602382][url]http://delphi.about.com/od/adptips2004/a/bltip0604_4.htm[/url]

:p

And just use PostKeyEx32 just a normal KeyDown & KeyUp :)[/QUOTE]

I'm using the SendInput api like nxtitle, it's quite interesting, never actually heard of it, but it allows for much more control than keyb_event, though I suppose the keyb_event api is based on it.

I'm probably going to toss out the current SendKeys function and replace it with mine, it's uses delays and stuff so it's as safe to use as TypeSend.

Daniel

2009-07-16 16:04:18

From: Freddy1990
I'm using the SendInput api like nxtitle, it's quite interesting, never actually heard of it, but it allows for much more control than keyb_event, though I suppose the keyb_event api is based on it.

I'm probably going to toss out the current SendKeys function and replace it with mine, it's uses delays and stuff so it's as safe to use as TypeSend.


Isn't that what SendKeysWait is for though? And some people still like to use the current SendKeys (instantaneous typing) in things (like me) :)

Freddy1990

2009-07-16 16:28:35

[QUOTE=Dan's The Man;602482]Isn't that what SendKeysWait is for though? And some people still like to use the current SendKeys (instantaneous typing) in things (like me) :)

SendKeysWait is a disaster, propably one of the first ones to go in SCAR 4, lol. I've finished the new SendKeys functions, it doesn't have delays like before, but it can type a whole lot more stuff, including the characters 161-255, it can't type all special characters, but it can type most of them. I've also added a second function, TypeKeys, which is the same functions, but with the delays, making it as safe to use as TypeSend in SRL. I'm still tweaking it a tad-bit here and there, but it works great.

The functions support these characters:
9-10, 13, 20-126, 128, 161-255

(10 does a return same as 13, 10 is the line feed character)

nielsie95

2009-07-16 16:43:23

Will it also work for localized keyboards? @ for example; some people need to do ALT GR (Right Alt) + 2 instead of SHIFT + 2.

Freddy1990

2009-07-16 16:45:49

From: nielsie95
Will it also work for localized keyboards? @ for example; some people need to do ALT GR (Right Alt) + 2 instead of SHIFT + 2.


In theory it should work for localized keyboards, yes, I've noticed NxTitle's function wouldn't though, it's based on his keyboard layout, for example he uses Shift + 2 for @ which for me would simply output 2. It does use Alt Gr and such when needed.

EDIT: Works fine when I switch my layout to US

Nadeem

2009-07-19 07:43:56

Hey guys,


I have finally finished it completely and working like a charm :)

http://www.villavu.com/forum/showthread.php?p=603681



~NS