Log in

View Full Version : GetXPBar crashes Simba?



sickle
05-24-2012, 04:27 AM
The script I was working on was fine until I added GetXPBar function. :(

Any ideas? In terms of syntax, it should have been good because I followed abu's tutorial. It would compile and load up fine, but before the player started moving I got an error message saying Simba was in serious trouble and had to close. Kept repeating until I took out the GetXPBar. ??

Abu
05-24-2012, 04:29 AM
You need to update your Simba with the latest version: http://l0.lt/builders/master

Brandon
05-24-2012, 04:48 AM
Absolutely do not update your Simba.. Trust me on this one. I was having the same problem. If your on 0.99+ then the following is for you (otherwise Iunno):

Uninstall Simba, Delete Settings.XML from C:/Simba. Save your C:/Simba/Scripts folder but delete everything else.. Install: http://simba.villavu.com/bin/Release/0.98/SimbaInstaller.exe

Open it and press the refresh looking button. It will update to 0.984.. Anything higher such as 0.99 gives that stupid error. I spent hours trying to figure out why but can't..

sickle
06-18-2012, 10:42 PM
I am running into this problem again in my little script. Can someone take a look? It was working fine and then suddenly SIMBA started crashing. It stopped doing that only when I took out all functions related to retrieving EXP (GetXPBarTotal, GetXPBar, XPTillNexTLevel, GetXP).

FYI of course all my things are up to date.

P1ng
06-19-2012, 01:43 AM
What's the script for? Post/PM me the code abd ill give it a test for you

sickle
06-20-2012, 01:24 PM
So basically this is the problem part. When I take out functions related to retrieving EXP, it works fine.


procedure PrintProgress;
begin
MiningLvl := GetSkillLevel(SKILL_MINING);
RealXP := ((GetXPBarTotal) - StartXP);
RealXPH:= Round(((RealXP) / (GetTimeRunning / 1000)) * 3600);

if not(Trips>1) then
begin
Lvltime := Round(XpTillNextLevel(SKILL_MINING)/RealXPH);
TillMax := 13034431/XPH/24;
end;


PrintOnSmart(['by sickle'],Point(9, 185), 4082573, 131072);
PrintOnSmart(['Running for: '+TimeRunning,
'XP: '+IntToStr(RealXP) + ' (lv.'+IntToStr(MiningLvl)+')',
'XPH: '+IntToStr(RealXPH),
'-> lv.'+IntToStr(MiningLvl+1)+': '+IntToStr(XpTillNextLevel(SKILL_MINING))+' xp (~ '+IntToStr(LvlTime)+' hrs)/'+IntToStr(TillMax)+' days ->99',
IntToStr(numOre) + ' coals, ' + IntToStr(numMith) + ' miths, and ' + IntToStr(numGems) + ' gems (='+IntToStr(XP)+' xp)',
IntToStr(gp) + ' gp (' + IntToStr(gph) + ' gp/hr)',
'Trips: ' + IntToStr(Trips),
'',
''], Point(9, 215), 13090170, 131072);
end;

P1ng
06-20-2012, 03:18 PM
There is an absolute tonne of integers in that one section of code, but if I declare them all before the procedure and add the includes to the top of the script it compiles. This was really hard to test without all the rest of the script, I ended up just inputting some of my own values into the script to remove a 'Divide by zero' error.

Simba didn't like PrintOnSmart, so I replaced it with SMART_DrawTextEx which in turn meant I had to remove all of the commas and so on.

When it all boils down to it the actual code that I changed was -
PrintOnSmart(['by sickle'],Point(9, 185), 4082573, 131072);
PrintOnSmart(['Running for: '+TimeRunning,
'XP: '+IntToStr(RealXP) + ' (lv.'+IntToStr(MiningLvl)+')',
'XPH: '+IntToStr(RealXPH),
'-> lv.'+IntToStr(MiningLvl+1)+': '+IntToStr(XpTillNextLevel(SKILL_MINING))+' xp (~ '+IntToStr(LvlTime)+' hrs)/'+IntToStr(TillMax)+' days ->99',
IntToStr(numOre) + ' coals, ' + IntToStr(numMith) + ' miths, and ' + IntToStr(numGems) + ' gems (='+IntToStr(XP)+' xp)',
IntToStr(gp) + ' gp (' + IntToStr(gph) + ' gp/hr)',
'Trips: ' + IntToStr(Trips),
'',
''], Point(9, 215), 13090170, 131072);

and I replaced it with -
SMART_DrawTextEx(False, 9, 185, UpChars, 'by sickle', ClWhite);
SMART_DrawTextEx(False,9,215,UpChars,'Running for: '+ TimeRunning + 'XP: '+IntToStr(RealXP) + ' (lv.'+IntToStr(MiningLvl)+') XPH: '+IntToStr(RealXPH) + ' -> lv.'+IntToStr(MiningLvl+1)+': '+IntToStr(XpTillNextLevel(SKILL_MINING))+' xp (~ '+IntToStr(LvlTime)+' hrs)/'+IntToStr(TillMax)+' days ->99 ' + IntToStr(numOre) + ' coals, ' + IntToStr(numMith) + ' miths, and ' + IntToStr(numGems) + ' gems (='+IntToStr(RealXP)+' xp) ' + IntToStr(gp) + ' gp (' + IntToStr(gph) + ' gp/hr) Trips: ' + IntToStr(Trips),ClWhite);


Now what I replaced it with will print all of your progress report on one really long line. You will need to go and break each part up into it's own individual lines and give them their own starting co-ordinates if you wish to use this method. Furthermore, I recommend putting "SMART_ClearCanvas;" at the beginning of your progress report, otherwise Simba will continue posting your new information on top of what it already has there without erasing it.

But in the end, I'm not sure what was making your Simba crash because all of those functions implemented in there work perfectly fine for me. It's quite possible that it is another part of your script, but without seeing the error message printed it is hard to know.

Final result -
procedure PrintProgress;
begin
MiningLvl := GetSkillLevel(SKILL_MINING);
RealXP := ((GetXPBarTotal) - StartXP);
RealXPH:= Round((RealXP) / (GetTimeRunning * 3600));

if not(Trips>1) then
begin
Lvltime := Round(XpTillNextLevel(SKILL_MINING)/RealXPH);
TillMax := 13034431/RealXPH/24;
end;

SMART_DrawTextEx(False, 9, 185, UpChars, 'by sickle', ClWhite);
SMART_DrawTextEx(False,9,215,UpChars,'Running for: '+ TimeRunning + 'XP: '+IntToStr(RealXP) + ' (lv.'+IntToStr(MiningLvl)+') XPH: '+IntToStr(RealXPH) + ' -> lv.'+IntToStr(MiningLvl+1)+': '+IntToStr(XpTillNextLevel(SKILL_MINING))+' xp (~ '+IntToStr(LvlTime)+' hrs)/'+IntToStr(TillMax)+' days ->99 ' + IntToStr(numOre) + ' coals, ' + IntToStr(numMith) + ' miths, and ' + IntToStr(numGems) + ' gems (='+IntToStr(RealXP)+' xp) ' + IntToStr(gp) + ' gp (' + IntToStr(gph) + ' gp/hr) Trips: ' + IntToStr(Trips),ClWhite);
end;

sickle
06-20-2012, 04:07 PM
Thanks! I'll test what you showed me. Just to be more clear, when I say crash, it means that when it's retrieving EXP (from a skill, totalxp from the xpbar, etc.) it simply freezes right there and then. It was NOT like this in the beginning, but it happened after a couple hours of doing that. Taking them out solved the crash, but now I have a less than accurate, real-time method of xp counting (i.e. counting what goes into the inventory). Any ideas?

P1ng
06-20-2012, 05:27 PM
My Air runner script prints a progress report after crafting the runes (this is so i can count the # of runes that were made per round with multiple runes and so on).

But all it utilizes for XP gain is this here:
CurrentXP := GetXPBarTotal;
XP := (CurrentXP - OriginalXP);
Where OriginalXP := GetXPBarTotal; which is placed prior to any activities performed in my mainloop.

This is a perfectly quick and efficient way of gathering xp.
I then, rather than having a big list of mathematical equations at the beginning of my progress report procedure implement those equations into my WriteLn's, cutting down on extra lines and un-necessary variables.

i.e.
Writeln('Est XP Per Hr: ' + IntToStr(round(3600000 * 1.0 / GetTimeRunning * XP)));

Where increases in levels are concerned I use :
Writeln('Levels Ga1ned: ' + IntToStr(LvlIncrease));

Where 'LvlIncrease' is an integer which I raise with this procedure:
procedure LvlInc;
begin
if not LoggedIn then
Exit else
Wait(RandomRange(500,750));
if FindBlackChatMessage('advanced') then
begin
LevelUp;
Inc(LvlIncrease);
end else
Exit;
end;

And I would call 'LvlInc' after my character has performed a task in which it might level up in (in my case after crafting the runes).

For detecting how many of each kind of ore and gems you have retrieved I would suggest perhaps using ACA to determine a colour unique to each of the items you may gain and then when it has completed an inventory use CountColorTolerance to determine how many instances of each colour appear in your inventory thus determining how many of each item was obtained.