SRL Archive - First Scripts

Kharid Wars Autofighter


kiko

2008-12-07 02:11:03

Hey guys, this will be my first posted scar script. It's a work in progress but it (finally) at least functions, so I thought I'd put it up and get some feedback.

The premise is basically to buy kebabs from the store for 1gp each, and then use the food to train against Al Kharid Warriors. It does this using a bunch of boolean tests working together to determine your player's location, and utilizes available minimap icons to walk back and forth.

The script has been updated!
Whats new:
- DeclarePlayers
- AntiRandoms
- Some AntiBan
- Attempted standardization
- Improved NPC finding

Why it's lacking:
- No coin picking
- Sketchy walking procedures
- Report is not very accurate
- No Failsafes :(
- Much more lol

Feedback is much appreciated!! It's quite simple so there's plenty to be done. Thanks!

benjaa

2008-12-07 18:53:11

procedure DeclarePlayers;
begin
HowManyPlayers := 1; //<------- This May Need Editing
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :=''; //if you don't know what to write here, press Alt + F4
Players[0].Active := True;
Players[0].Loc := 'kebab store';//where are we
end;

You also need to use if a little more, for some kind of failsafes

eg.
if(FindSymbol(x, y, 'minigame'))then
begin
Mouse(x, y, 5, 5, True);
Flag;
end else
DoSomethingElse;

also AtKebabs = true can simply be AtKebabs

im thinking FlagPresent is the red flag in the minimap?
if so, theres a procedure called Flag; which finds a flag, and waits until the player gets to it

A simple procedure for you;
FindNormalRandoms

Also, in every procedure use if(not LoggedIn)then exit;

also need to work on standards a little

other than that, its a really good idea which has the capacity to run for a LONG time :)

good luck

Brodyf11

2008-12-07 19:00:30

Nice first script, can't wait for mine.

benjaa

2008-12-07 19:03:11

From: Brodyf11
Nice first script, can't wait for mine.


Good. Really quite helpful.

kiko

2008-12-07 23:40:21

Thanks for all the input Benjaa! I have mostly standardized it now, and am working on DeclarePlayers.

Failsafes and randoms definitely are on my list as well haha.

benjaa

2008-12-08 00:36:42

Thanks for all the input Benjaa!


No problems :) Glad I could help.

In my opinion, SRL antirandoms could use alot of work. A large portion of the scripts I use still have problems with Box and Sandwich lady, not to mention Rick Turpentine.

What makes a fighter script hard, is that it will be difficult to detect Evil Chickens and Swarms if you're constantly fighting [InFight will be useless].

I can't really give you too much advice on Failsafes, just with every If have an else. Tehe

There should be numerous threads to help out though. Good Luck!

The_Shermanator

2008-12-08 00:40:08

Looks like a very nice script, has a lot of potential.
Just try to work on these things:
  • Scripting standards.
  • Fail-safes.
  • RadialWalking/better walking.
Hope this helps :D


-The_Shermanator

kiko

2008-12-09 01:05:32

Ok the script has been updated!!
Lots of steps in the right direction with a lot of help; it's approaching being a viable script which is awesome :D

benjaa

2008-12-09 01:14:09

Line 257: FindObjCustom(x, y, ['att', 'warri'], [WarriorColor1, WarriorColor2], 4);
Do you mean "att" as in Attack? if so, it needs capitalizing.

Looking nice, ill test tonight

Edit: Add TimeRunning into reporting.

AddToReport('Time running = '+TimeRunning);

Edit Edit: I suggest coin picking up! because it needs to buy kebabs, why not collect coins? Use FindObjCustom for pickups, and CoinAmount to count it :)

kiko

2008-12-09 01:39:44

Nice catch with FindObj!
Fixed that and several other key bugs which would prevent it from running for very long. Should work for a while now, grab 1.11 :)

benjaa

2008-12-09 01:57:45

Ok, I'm running now; and already I've found;

At Line 99: FindSymbol('minigame') instead of quest works better
At Line 193: I put this in;
begin
if not LoggedIn then Exit;
SymbolAccuracy := 0.4;
if((NoFood) and (AtWarriors) and (not InvFull)) then
begin
Status('Going to get Kebabs...');
At Line 211/212: Go to "cook" symbol instead of "furnace". Then click x, y not x, y+50

Edit: Fighting is a little too robotic, spin the compass every so often, change the height: RandomMoveMent or BoredHuman

Also, a gift from me to you:

procedure PickUpCoins;
var
cx, cy : integer;
begin
if(not LoggedIn)then exit;
if(FindObjCustom(cx, cy, ['oins'], [1545139], 10))then
begin
Case(Random(3))of
0: begin
Mouse(cx, cy, 4, 4, False);
Wait(100 + Random(120));
ChooseOption('ake');
end;
1, 2: Mouse(cx, cy, 4, 4, True);
end;
Flag;
end;
end;


PROGGY:


 ____________________ 
//\ Kharid Wars \
\_/ v1.0 /
/``````````````````/
( Killed 000 NPc's (
( Got 000 Kebabs (
( Gained 0 Levels (
( ________________\
\ /\ By kiko \
\_/________________/
Ran for 3 Seconds

Something tells me you're not calling Report frequently enough.
It actually ran for 5-7 mins while I was in the shower.

I started with 40 gp, and finished with 193 with the pickup procedure.

It wouldve killed quite a few, I had to fix up FightWarriors, Ill post later

Gotta run to work!

kiko

2008-12-09 03:01:30

Ahah, thanks for symbolaccuracy, I was looking for that (its the reason i used furnace, people stand on it less lol). Added the coin picker as well, looks nice!
EDIT: Changing to Minigame at line 99 doesn't work well because it can be seen from the kebab shop. That's why if it doesn't find quest, it looks for a warrior to tell :\

Also, I stopped reporting during fighting cause it would check your levels between each fight (annoying!). Fixed it so it doesn't do that anymore :)

And fighting is definitely way too robotic, I'll tackle that next.

benjaa

2008-12-09 07:21:13

Ohh ok, yeah, if only the quest symbol was in the middle more…

Maybe have the reporting: take your exp at the start, and save to variable;

Then after every fight, update other parts of report (not exp), then insert the old exp variable you saved.

And update the exp variable only every so often

Kebab buying is also too coords-based
It would be better if you looked for the words to click

maybe /core/text.scar would help

i just got back from work, so im testing it again now

benjaa

2009-01-04 19:29:04

Yo, haven't heard from you in a while

If you're still interested in making this script, I have alot of ideas for this script, one being Reflection

Pm me dude

Cookiemonster37

2009-01-05 00:58:53

Very very impressive for a first script! You have a lot of potential.