SRL Archive - SRL Suggestions

QCSkillLevel(Skill:String):Boolean;


Sin

2012-05-18 10:13:45

This took me a long time to write, so a push would be nice :)
I can't access the GIT at school so I can't request it :l.
Also, I do not know the byte code for 'Enter' so please replace the variable K with the byte code.

Function QCSkillLevel(Skill:String):boolean;
var
k:Integer;
begin
k := 0; //code for 'Enter'
case Lowercase(skill) of
'Attack':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('g',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Strength':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('g',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Defence':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('d',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Hitpoints':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('l',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Agility':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('a',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Magic':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('m',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Cooking':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('v',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Firemaking':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('p',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Mining':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('i',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Smithing':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('b',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Fishing':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('w',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Ranged':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('r',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Prayer':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('y',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Runecraft':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('n',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Dungeoneering':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('f',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Construction':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('c',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Fletching':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('e',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Slayer':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Hunter':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('u',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Farming':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('q',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Thieving':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('t',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Crafting':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('x',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Woodcutting':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('j',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Summoning':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('o',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
'Herblore':
begin
TypeByte(k);
TypeSendEx('s',False);
Wait(100 + random(50));
TypeSendEx('h',False);
Wait(100 + random(50));
TypeSendEx('2',False);
end;
Result := True;
end;

Tbh, I think it's kinda sad, I typed all the QC codes out via memory :(

Gu3st...

2012-05-18 11:00:53

I think there's a bug in there; both Attack and Strength have the same character (g)

Also, all that repetitive code can be shortened using an array:
procedure QC_SaySkillLevel(const Skill : Integer);
var
skill_Arr : String;
begin
if not InRange(Skill, SKILL_ATTACK, SKILL_DUNGEONEERING) then Exit;

skill_Arr := 'ggdlamvpibwrynfcesuqtxjoh';

TypeSendEx('', True); //Enter
TypeSendEx('s', False);
Wait(100 + Random(50));
TypeSendEx(skill_Arr[Skill], False);
Wait(100 + Random(50));
TypeSendEx('2', False);
end;
I haven't tested it, and the characters (ggdlamvpibwrynfcesuqtxjoh) are from the original function, so attack and strength will say the same level, but I just wanted to show how this function could be shortened a lot

Le Jingle

2012-05-20 22:06:17

From: Zyt3x
I think there's a bug in there; both Attack and Strength have the same character (g)

Also, all that repetitive code can be shortened using an array:

procedure QC_SaySkillLevel(const Skill : Integer);
var
skill_Arr : String;
begin
if not InRange(Skill, SKILL_ATTACK, SKILL_DUNGEONEERING) then Exit;

skill_Arr := 'ggdlamvpibwrynfcesuqtxjoh';

TypeSendEx('', True); //Enter
TypeSendEx('s', False);
Wait(100 + Random(50));
TypeSendEx(skill_Arr[Skill], False);
Wait(100 + Random(50));
TypeSendEx('2', False);
end;
I haven't tested it, and the characters (ggdlamvpibwrynfcesuqtxjoh) are from the original function, so attack and strength will say the same level, but I just wanted to show how this function could be shortened a lot




Quick Chat -> Skills ->

A. Agility
Z. Attack
L. Constitution
C. Construction
V. Cooking
X. Crafting
D. Defence
F. Dungeoneering (lol [i]eff[/i]" Dg'ing)
Q. Farming
P. Firemaking
W. Fishing
E. Fletching
H. Herblore
U. Hunter
M. Magic
I. Mining
Y. Prayer
R. Ranged
N. Runecrafting
S. Slayer
B. Smithing
G. Strength
O. Summoning
T. Thieving
J. Woodcutting


* That list, following that ^ order, results;

azlcvxdfqpwehumiyrnsbgotj

* Or if you want in re-arranged in the way OP(s1) posted;

zgdlamvpibwrynfcesuqtxjoh

*** Tested the quoted proc via Zyt3x, along with the re-done letters I posted, works great.


{
Ex.
}
QC_SaySkillLevel(1); // Results me qc'ing my att lvl. :>

Yago

2012-05-21 21:33:59

From: Le Jingle


Quick Chat -> Skills ->

A. Agility
Z. Attack
L. Constitution
C. Construction
V. Cooking
X. Crafting
D. Defence
F. Dungeoneering (lol [i]eff[/i]" Dg'ing)
Q. Farming
P. Firemaking
W. Fishing
E. Fletching
H. Herblore
U. Hunter
M. Magic
I. Mining
Y. Prayer
R. Ranged
N. Runecrafting
S. Slayer
B. Smithing
G. Strength
O. Summoning
T. Thieving
J. Woodcutting


* That list, following that ^ order, results;

azlcvxdfqpwehumiyrnsbgotj

* Or if you want in re-arranged in the way OP(s1) posted;

zgdlamvpibwrynfcesuqtxjoh

*** Tested the quoted proc via Zyt3x, along with the re-done letters I posted, works great.


{
Ex.
}
QC_SaySkillLevel(1); // Results me qc'ing my att lvl. :>


I think the order they posted makes special use of the constants in SRL…

Le Jingle

2012-05-21 21:58:31


{$i SRL/SRL/misc/quickchat.simba}


{*******************************************************************************
procedure QCSayLevel(Which: string);
By: EvilChicken!
Description: Says 'Which' skill level using Quick Chat.
*******************************************************************************}
procedure QCSayLevel(Which: string);
var
Skill: Char;
begin
case LowerCase(Which) of
'agility', 'agil': Skill := 'a';
'attack', 'atk': Skill := 'z';
'construction', 'con': Skill := 'c';
'cooking', 'cook': Skill := 'v';
'crafting': Skill := 'x';
'defence', 'def': Skill := 'd';
'farming', 'farm': Skill := 'f';
'firemaking', 'fm': Skill := 'p';
'fishing': Skill := 'w';
'fletching', 'fletch': Skill := 'e';
'herblore', 'herb': Skill := 'h';
'hitpoints', 'hp': Skill := 'l';
'hunting', 'hunter': Skill := 'u';
'magic', 'mage': Skill := 'm';
'mining': Skill := 'i';
'prayer', 'pray': Skill := 'y';
'range', 'ranged': Skill := 'r';
'runecrafting', 'rc': Skill := 'n';
'slayer': Skill := 's';
'smith', 'smithing': Skill := 'b';
'strength', 'str': Skill := 'g';
'summoning', 'sum': Skill := 'o';
'thieving', 'thief': Skill := 't';
'woodcutting', 'wc': Skill := 'j';
else
begin
srl_Warn('QCSayLevel', Which + ' is an invalid skill ', warn_AllVersions);
Exit;
end;
end;
QCOpenMenu('skills', [Skill, '2']);
end;