SRL Archive - Discussions and Debates

monster xp function


HyperSecret

2007-10-24 00:53:26

is there a function where you can type the monsters name in and you can have it load their xp to count the xp gained? if not im gonna make one and it would be helpfull if anyone knew a table with the monsters on it with their xp…?

Santa_Clause

2007-10-24 02:42:02

RuneHQ should have it. There are too many monsters though…

mat_de_b

2007-10-24 07:49:24

just times it's health by 4

Special Ed

2007-10-26 22:08:29

Either way you'd need to figure out all the monsters Hp's then right?

Maybe this could be a project for MSI after the competition is over?

Boreas

2007-10-27 02:44:35

program New;
{Copy RHQ table (page by page, 11 of them) into a text file.
Set name and location of that text file in const.
Be careful how you copy them. I recommend copying the row above also
(Name etc) so that the spacing stays the same, just in case
(obviously delete that line once in text file). Just make sure
that spaces and chr(13)'s stay where they were.
Hit run, allow access to files. When it's done look in
SCAR folder for monster.ini. :)
}
const FileName='C:\monsters.txt';
var i,startfile,i2,i3:integer;
ordnum:byte;
mystrings:array [0..7] of string;
eom1,endofmonster,endofname,eon1,endofnamedone:boolean;
ans,ans2,anstemp,monstername:string;
begin
startfile:=openfile(FileName,true);
repeat
i:=i+1;
ans2:='';
endofmonster:=false;
eom1:=false;
endofname:=false;
eon1:=false;
endofnamedone:=false;
for i2:=0 to 7 do
mystrings[i2]:='';
i2:=0;
repeat
ReadFileString(startfile,ans,1);
ordnum := getkeycode(ans[1]);
if (ordnum=13) and (eom1) then
endofmonster:=true;
if (ordnum=13) and (not eom1) then
eom1:=true;
if (ordnum=9) and (eon1) then
endofname:=true;
if (not endofnamedone) and (ordnum=32) and (not eon1) then
eon1:=true;
ans2:=ans2+ans;
if endofnamedone and (ordnum=9) then
ans2:='';
if (endofnamedone and ((ordnum=32) or((ordnum=13))) ) then
begin
anstemp:=trim(ans2);
anstemp:= replace(anstemp,chr(13),'');
anstemp:=replace(anstemp,chr(9),'');
anstemp:=replace(anstemp,chr(55),'');
mystrings[i2]:=anstemp;
i2:=i2+1;
end;
if not(endofnamedone) and (endofname) then
begin
delete(ans2,length(ans2)-1,length(ans2));
for i3:=1 to length(ans2) do
begin
if getkeycode(ans2[i3])=13 then
delete(ans2,i3,i3);
end;
monstername:=ans2;
ans2:='';
endofnamedone:=true;
end;
until endofmonster or (i2=8);
writeini(monstername,'Name',monstername,apppath+'monster.ini');
writeini(monstername,'Combat Level',mystrings[0],apppath+'monster.ini');
writeini(monstername,'Members Only',mystrings[1],apppath+'monster.ini');
writeini(monstername,'HP',mystrings[2],apppath+'monster.ini');
writeini(monstername,'XPC',mystrings[3],apppath+'monster.ini');
writeini(monstername,'XPA',mystrings[4],apppath+'monster.ini');
writeini(monstername,'CXP',mystrings[5],apppath+'monster.ini');
writeini(monstername,'SXP',mystrings[6],apppath+'monster.ini');
writeini(monstername,'SLXP',mystrings[7],apppath+'monster.ini');
until i=100;
closefile(startfile);
end.

If you could make something to search the INI, like the RHQ one does, that would be awesome.

rogeruk

2007-10-27 03:43:01

I don't think you would get accurate EXP gained, because while fighting you and the monster can gain health. Therfor it gains +1/2 HP. Or it could heal itself therefor you would get more HP.

For EXP you'd be better off grabbing the EXP before the fight, and calculating how much earned after.

Boreas

2007-10-27 08:35:44

Also, getting the xp divided by hp from the table, and then watching for the red hit damage numbers, and multiplying those might work.

ShowerThoughts

2007-10-27 08:37:51

or just
monsterhp*4 ;)

Boreas

2007-10-27 08:53:25

Which monster xp are we talking about? Just SXP or others too?

XPC = Total XP for fighting controlled,
XPA = Total XP when fighting Accurate/Agressive or Defensive,
CXP = XP given to Hitpoints, or if fighting controlled,
SXP = XP when fighting Accurate/Agressive or Defensive,
SLXP = Slayer XP

ShowerThoughts

2007-10-27 09:12:27

ow, i mean just if you fighting on 1 thing so you wont get other xp on other levels like atack(and hitpoints if combat involved :p)

n3ss3s

2007-10-27 12:50:51

I whipped quickly one:


Procedure MonsterTotalEXP(Var AADC, HP: Integer);
Var
S: String;
begin
S := GetPage( 'http://www.runehq.com/RHQMonsterView.php?id=20');
AADC := StrToInt(Between('Total XP for fighting Controlled:<br /><br />', '</td>', S));
HP := StrToInt(Between('XP given to Hitpoints, or if fighting Controlled:<br /><br />', '</td>', S));
End;

Gets the total xp for fighting controlled or Accurate/Agressive/Defence and HP.

AADC := Accurate…..
HP := HP…

Thats for Al-Kharid warrior, there will be hell of a case if we wanna get any there… Or then just go to RHQ yourself, get the ID from url…

If you want other info, its easy as those:


<td class="sitetblrowdark">Race/Type:<br /><br />Human</td>
<td class="sitetblrowdark">Combat Level:<br /><br />9</td>
<td class="sitetblrowdark">Number of Hitpoints:<br /><br />19</td>
<td>&nbsp;</td>
</tr>

<tr>
<td class="sitetblrow">Retreats?<br /><br />No</td>
<td class="sitetblrow">Members Only?<br /><br />No</td>
<td class="sitetblrow">Slayer XP:<br /><br />0</td>
<td class="sitetblrow">Hunter XP:<br /><br />0</td>

</tr>
<tr>
<td colspan="2" class="sitetblrowdark">Total XP for fighting Controlled:<br /><br />101</td>
<td colspan="3" class="sitetblrowdark">Total XP for fighting Accurate/Agressive/Defensive:<br /><br />101</td>
</tr>
<tr>
<td colspan="2" class="sitetblrow">XP given to Hitpoints, or if fighting Controlled:<br /><br />25</td>

<td colspan="3" class="sitetblrow">XP for fighting Accurate/Agressive/Defensive:<br /><br />76</td>

ShowerThoughts

2007-10-27 12:53:00

nice, w/e confusing ;)

Boreas

2007-10-27 17:42:41

n3ss3s try my thing, INI file is easier than a huge case

n3ss3s

2007-10-28 13:17:18

Seems like I gotta learn those INI things too, they seem handy.

R0b0t1

2007-10-28 13:45:34

And they are easy -.-


I wish Python could make .DLL files, it would be way simpler.


for line in urllib2.urlopen('http://www.runescape.com/title.ws'):
if 'There are currently' in line and 'playing!' in line:
print line

n3ss3s

2007-10-28 14:00:54

for line in urllib2.urlopen('http://www.runescape.com/title.ws'):
if 'There are currently' in line and 'playing!' in line:
print line


What language that is?

Damn easy/useful it seems..

R0b0t1

2007-10-28 14:26:32

Its Python :P.


But the regular compiler can't make .DLL files, you'd need a separate program.

Widget

2007-10-28 20:46:09

I've used Py2Exe to compile them into windows binaries, can it make DLLs too?

Edit: Maybe...

R0b0t1

2007-10-28 22:08:12

Nope, thats a COM(unications) server.

Boreas

2007-10-29 13:08:22

There was an error in the script above that creates the INI, so I'll just post the INI.

http://uppit.com/d/HHK1D

R0b0t1

2007-10-29 18:35:19

Ooooooooh.




Coool!