Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
In fact it should be a function rather than a procedure, so that it can result true or false;
If it gets in the include, it'll go into fighting.simba, and personally I'd have the DTMs loading on fighting setup and freeing on a FreeFighting procedure.
I'd also consider making a WaitFightEx, which instead of using MSC uses a TPoing provided by the script, so that WaitFightEx can be used by mages & rangers without having to wait for the monster to reach you, including the possibility that it doesn't reach you at all cus it dies on the way or you are safe spotting.
Other than that, looks good.
-RM
The facto that you are searching for your own damage bubbles, gives you the freedom to search the whole mainscreen, right? so no need for a WaitFightEx. This should be tested however.
this is what i did with the code snippet
Simba Code:Function WaitFight: Boolean;
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
MarkTime(Time); //marks the time
Repeat
Wait(50+Random(50)); //MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70
Result := FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2)or
FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2);
Until(TimeFromMark(Time) > 2250)or(Result); //if it hasn't found either for 2000msec then it exits, (i don't play RS much, is there a very slow weapon that this wouldn't work for?)
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;
Code:
- Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
- Solarwind: Dude, you are like... t3h s3x.
- Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
- benjaa: woah.... Jukka is the man Guildminer pwns all
- NaumanAkhlaQ: And JuKKa Is my Her0!
Code:
- Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
- Solarwind: Dude, you are like... t3h s3x.
- Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
- benjaa: woah.... Jukka is the man Guildminer pwns all
- NaumanAkhlaQ: And JuKKa Is my Her0!
Working good. Just took your function and manipulated it to fit my need.
I basicaly use the InFight function to see if the script should use your function. Once it think it might be in fight, it uses your function to confirm if we are the one under attack, or if it is just a false positive.
I'm using it at LRC in w84 (there is a crap load of people there, if it works there, it works everywhere) and it never fail. It only detect when I am the one under attack and it run to the bank to get the living rock creature off my ass.
My scripts:
Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
Questions? I bet that for 98% of those, you'll find answer HERE
Magician is right.. This is extremely slow on attack starts.. if ur already in a fight, then it's very fast.. but if ur using it to fight a monster, it is very slow as it will always wait that 2.5 seconds. If you lower the timer any more than that well it will start returning false positives. Using InFight to determine whether to use this function or not would be useless.. is this not supposed to remove the limitation and slowness of looking for an HP Bar? :S
No, it's used to eliminate false positive, or at least that's what I'm using it for.
Simba Code:function UnderAttack: Boolean;
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
if InFight then
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
SetDTMName(WaitFight_Shield, 'WaitFight Shield DTM');
SetDTMName(WaitFight_Damage, 'WaitFight Damage DTM');
MarkTime(Time);
repeat
Wait(50+Random(50));
if(FindDTM(WaitFight_Shield, x, y, MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70))
or (FindDTM(WaitFight_Damage, x, y, MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70)) then
begin
Result:= True;
Break;
end;
until(TimeFromMark(Time) > 3500);
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;
end;
This is the function I added to the LRC script in your thread. It detect if I am under attack by a living rock creature and decided if I should run away of keep mining.
As you know, LRC is crowded in world 84, and this means that the InFight function will return alot of false positive, since it also detect other's people HP bars.
With this function, everytime it detect an HP bar, it double check with the damage splash (or shield) and that way I can be 100% sure that I am the one under attack.
My scripts:
Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
Questions? I bet that for 98% of those, you'll find answer HERE
Could other players' damage be used to keep from attacking something already in combat with another player? Not sure if there is already a good way to do this.
Umm not sure if you added assigned those DTM's in there just so people can test easy... But you should load/free dtms on every function call..
Declare them globally and speed will be much better.
Anyway very nice function, I think it should be added.
8+ Years:C++, PICBASIC(ASM), Java, PHP, Perl, AHK
My last hobby (yes i was the dev):Electronic PIC Development And HERE
SMARTManager 0.91 (Script management/6 Hour limit fix): View thread here
Like my work? Help me out: http://villavu.com/forum/showthread.php?p=984147#
^great idea.
Expanding in the infight proecde, we could get an array of hitsplat locs, and find a monster who is not right next to/on a hit splat. If no matches are found, maybe just click the one farthest from a hitsplat, and hope its not under atk? or could just return false so that it can be called again when a monster has spawned away from hitsplats.
My scripts: LunarPlanker
---
My Utilities: Cross Platform, Open Source, SPS Path Generator
Join the Unoficial SRL Skype Group by clicking here, or visiting this thread.
There are currently 1 users browsing this thread. (0 members and 1 guests)