SRL Archive - MSI Archives

The Current State of magic 10/15/10


nickrules

2010-10-15 10:51:43

Magic is currently untested, and for that matter, hasn't even been compiled. In order to be able to test it properly (as in, with out commenting out pretty much everything), the spells need to be added to globals.simba, and the staff and rune TItems need to be added.
We need a way to add this, ideally without rewriting a ton of magic.simba, or wait for the form.

With SetupMagic, it needs to be made to check if we have the runes, and if not, get them from the bank.

A way to determine something else that I can't think of anymore because i walked away mid sentience also needs to be made. If i remember it, I'll post it :redface:

Coh3n

2010-10-15 19:16:44

Since DeclarePlayers needs a drastic change (I'm still working on it, sorry for the delay :o), we need to find alternative ways of testing.

Here's what I suggest. Commit the TItems/Constants first. Once that is done, we can add (but not yet commit) Magic.simba. Anything in the magic functions that require something that isn't yet in DeclarePlayers (such as a string) - create a temporary constant/variable just for testing. Set the constant to what you want, have the function in Magic.simba use that constant.

Know what I mean? Also, comment out MSI_Mainloop; in RunMe.simba, and just call the functions in Magic.simba you want to test. I find this the easiest way to test new or updated functions in MSI.

nickrules

2010-10-15 20:13:04

Alrighty then, sounds good. I'll get around to updating the TItems, and create a list of all the constants.

nickrules

2010-10-15 23:38:01

un updated TItems:

//TItems
STAFF_AIR:
with MSI_Items[whichItem] do
begin
Name := 'Air staff';
UpText := ['of air'];
ItemP := Point(0, 0);
Colors := [12235442, 13353922, 12564407];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;

STAFF_WATER:
with MSI_Items[whichItem] do
begin
Name := 'Water staff';
UpText := ['of water'];
ItemP := Point(0, 0);
Colors := [11804186, 14427424, 13115933];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;

STAFF_EARTH:
with MSI_Items[whichItem] do
begin
Name := 'Earth staff';
UpText := ['of earth'];
ItemP := Point(0, 0);
Colors := [3227223, 4874115, 4808066];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;

STAFF_FIRE:
with MSI_Items[whichItem] do
begin
Name := 'Fire staff';
UpText := ['of fire'];
ItemP := Point(0, 0);
Colors := [1713844, 1977293, 2109145];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(whichItem);
end;

//MSI_GetItemColor
STAFF_AIR : Result := 12235442;
STAFF_WATER : Result := 13115933;
STAFF_EARTH : Result := 4610428;
STAFF_FIRE : Result := 1911496;
//DDTM Points
STAFF_AIR..STAFF_FIRE:
Result := [ Point(586, 219), Point(587, 216), Point(586, 223),
Point(566,242), Point(578,225)];

Spell Consts:
    SPELL_WIND_STRIKE    := 0;
SPELL_WIND_BOLT := 1;
SPELL_WIND_BLAST := 2;
SPELL_WIND_WAVE := 3;

SPELL_WATER_STRIKE := 4;
SPELL_WATER_BOLT := 5;
SPELL_WATER_BLAST := 6;
SPELL_WATER_WAVE := 7;

SPELL_EARTH_STRIKE := 8;
SPELL_EARTH_BOLT := 9;
SPELL_EARTH_BLAST := 10;
SPELL_EARTH_WAVE := 11;

SPELL_FIRE_STRIKE := 12;
SPELL_FIRE_BOLT := 13;
SPELL_FIRE_BLAST := 14;
SPELL_FIRE_WAVE := 15;

SPELL_STATE_CONFUSE := 16;
SPELL_STATE_WEAKE := 17;
SPELL_STATE_CURSE := 18;
SPELL_STATE_BIND := 19;

SPELL_TELE_HOME := 20;
SPELL_TELE_VARROCK := 21;
SPELL_TELE_LUMBY := 22;
SPELL_TELE_FALLY := 23;

SPELL_ALCH_LOW := 24;
SPELL_ALCH_HIGH := 25;

SPELL_TELEGRAB := 26;
SPELL_SUPERHEAT := 27;

commit please.

Coh3n

2010-10-16 03:16:41

Committed. We also need rune constants and records. :)

nickrules

2010-10-16 09:42:11

//TItems
RUNE_AIR:
with MSI_Items[whichItem] do
begin
Name := 'Air rune';
UpText := ['ir r'];
ItemP := Point(0, 0);
Colors := [10296087];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_WATER:
with MSI_Items[whichItem] do
begin
Name := 'Water rune';
UpText := ['er ru'];
ItemP := Point(0, 0);
Colors := [10296087];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_EARTH:
with MSI_Items[whichItem] do
begin
Name := 'Earth rune';
UpText := ['th ru'];
ItemP := Point(0, 0);
Colors := [867676];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_FIRE:
with MSI_Items[whichItem] do
begin
Name := 'Fire rune';
UpText := ['ire ru'];
ItemP := Point(0, 0);
Colors := [1515933];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_MIND:
with MSI_Items[whichItem] do
begin
Name := 'Mind rune';
UpText := ['nd run'];
ItemP := Point(0, 0);
Colors := [2129366, 538424];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_BODY:
with MSI_Items[whichItem] do
begin
Name := 'Body rune';
UpText := ['ody r'];
ItemP := Point(0, 0);
Colors := [921102, 12656924];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_CHAOS:
with MSI_Items[whichItem] do
begin
Name := 'Chaos rune';
UpText := ['haos'];
ItemP := Point(0, 0);
Colors := [2137558, 13948126, 538424];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_DEATH:
with MSI_Items[whichItem] do
begin
Name := 'Death rune';
UpText := ['ath ru'];
ItemP := Point(0, 0);
Colors := [13948126, 921102];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_NATURE:
with MSI_Items[whichItem] do
begin
Name := 'Nature rune';
UpText := ['ture r'];
ItemP := Point(0, 0);
Colors := [1408531];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_COSMIC:
with MSI_Items[whichItem] do
begin
Name := 'Cosmic rune';
UpText := ['osmic'];
ItemP := Point(0, 0);
Colors := [2151638];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_LAW:
with MSI_Items[whichItem] do
begin
Name := 'Law rune';
UpText := ['aw ru'];
ItemP := Point(0,0);
Colors := [14034208];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
//DTM
RUNE_AIR..RUNE_LAW:
Result := [
Point(999, 557),
Point(998, 544),
Point(1000, 572),
Point(1012, 556),
Point(985, 557)
];
//GetColor
RUNE_AIR : Result := 13948126;
RUNE_WATER : Result := 10296087;
RUNE_EARTH : Result := 867676;
RUNE_FIRE : Result := 1515933;
RUNE_MIND : Result := 538424;
RUNE_BODY : Result := 7829373;
RUNE_CHAOS : Result := 13948126;
RUNE_DEATH : Result := 13948126;
RUNE_NATURE: Result := 1408531;
RUNE_COSMIC: Result := 2151638;
RUNE_LAW : Result := 14034208;

Interesting problem, one color is used 3 times. will this cause problems?

Coh3n

2010-10-16 13:12:25

From: nickrules
Interesting problem, one color is used 3 times. will this cause problems?

Yes, it will get confused between those three runes.

nickrules

2010-10-16 13:45:39

ugh. What should we do then? because the image on the runes is flat (it has no shading whatsoever. its the same shade of white across the whole rune)

i luffs yeww

2010-10-16 15:06:13

Are you not using GetColor to find it at a specific point? If not, why not? If they're still all he same color in that point, use a different point. There is a way around this.

GetTPABounds or something and then GetColor((Bounds.x2 - Bounds.x1) div 2, (Bounds.y2 - Bounds.y1) div 2));

Coh3n

2010-10-16 16:40:47

From: nickrules
ugh. What should we do then? because the image on the runes is flat (it has no shading whatsoever. its the same shade of white across the whole rune)

What runes have the same colors? The point you pick doesn't have to be EXACTLY the same on every rune.

nickrules

2010-10-16 23:30:48

I like… never pick the exact same point. Way, way way way too lazy for that. I try to be at least somewhat close though…

Also, to answer the first point, Air, chaos (the center) and death.

From: i luffs yeww
Are you not using GetColor to find it at a specific point? If not, why not? If they're still all he same color in that point, use a different point. There is a way around this.

GetTPABounds or something and then GetColor((Bounds.x2 - Bounds.x1) div 2, (Bounds.y2 - Bounds.y1) div 2));


…….. What? I think I understand the first half… But would this work if the user had both air and death/chaos? it would pick up those colors too.

Coh3n

2010-10-17 01:42:07

From: nickrules
I like… never pick the exact same point. Way, way way way too lazy for that. I try to be at least somewhat close though…

Also, to answer the first point, Air, chaos (the center) and death..

There are unique colors for each, are there not?

Bonfield

2010-10-17 06:33:57

I luff yew, am I right in thinking that checks density?

nickrules

2010-10-17 09:08:33

From: Coh3n
There are unique colors for each, are there not?


For death and chaos….

So, i made a little change to the colors. now death and chaos wont get confused together, but they will still be confused with air.

E: Alternately, I could just make a custom rune finding function…

//TItems
RUNE_AIR:
with MSI_Items[whichItem] do
begin
Name := 'Air rune';
UpText := ['ir r'];
ItemP := Point(0, 0);
Colors := [13948126];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_WATER:
with MSI_Items[whichItem] do
begin
Name := 'Water rune';
UpText := ['er ru'];
ItemP := Point(0, 0);
Colors := [10296087];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_EARTH:
with MSI_Items[whichItem] do
begin
Name := 'Earth rune';
UpText := ['th ru'];
ItemP := Point(0, 0);
Colors := [867676];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_FIRE:
with MSI_Items[whichItem] do
begin
Name := 'Fire rune';
UpText := ['ire ru'];
ItemP := Point(0, 0);
Colors := [1515933];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_MIND:
with MSI_Items[whichItem] do
begin
Name := 'Mind rune';
UpText := ['nd run'];
ItemP := Point(0, 0);
Colors := [2129366, 538424];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_BODY:
with MSI_Items[whichItem] do
begin
Name := 'Body rune';
UpText := ['ody r'];
ItemP := Point(0, 0);
Colors := [921102, 12656924];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_CHAOS:
with MSI_Items[whichItem] do
begin
Name := 'Chaos rune';
UpText := ['haos'];
ItemP := Point(0, 0);
Colors := [2137558, 538424];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_DEATH:
with MSI_Items[whichItem] do
begin
Name := 'Death rune';
UpText := ['ath ru'];
ItemP := Point(0, 0);
Colors := [921102];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_NATURE:
with MSI_Items[whichItem] do
begin
Name := 'Nature rune';
UpText := ['ture r'];
ItemP := Point(0, 0);
Colors := [1408531];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_COSMIC:
with MSI_Items[whichItem] do
begin
Name := 'Cosmic rune';
UpText := ['osmic'];
ItemP := Point(0, 0);
Colors := [2151638];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
RUNE_LAW:
with MSI_Items[whichItem] do
begin
Name := 'Law rune';
UpText := ['aw ru'];
ItemP := Point(0,0);
Colors := [14034208];
Tol := 3;
Stackable := True;
DTM := MSI_LoadDTM(whichItem);
end;
//DTM
RUNE_AIR..RUNE_LAW:
Result := [
Point(999, 557),
Point(998, 544),
Point(1000, 572),
Point(1012, 556),
Point(985, 557)
];
//GetColor
RUNE_AIR : Result := 13948126;
RUNE_WATER : Result := 10296087;
RUNE_EARTH : Result := 867676;
RUNE_FIRE : Result := 1515933;
RUNE_MIND : Result := 538424;
RUNE_BODY : Result := 7829373;
RUNE_CHAOS : Result := 13948126;
RUNE_DEATH : Result := 13948126;
RUNE_NATURE: Result := 1408531;
RUNE_COSMIC: Result := 2151638;
RUNE_LAW : Result := 14034208;

Coh3n

2010-10-17 14:53:47

From: nickrules
For death and chaos….

So, i made a little change to the colors. now death and chaos wont get confused together, but they will still be confused with air.


I just looked at the runes and Air and Death are very similar, yeah, but Chaos shouldn't be a problem. Have you tried picking the color of one of the eyes in the Death rune? That may work.

nickrules

2010-10-17 15:16:53

Thats not the problem.
If the bot is searching the users inventory for an air rune (and lets say the have none), and the user has a death/chaos rune, its going to pick up that rune, and say that we do have air runes, when in reality, we don't.

Bonfield

2010-10-17 15:25:02

What about counting the number of white pixels? Like making a blacklist but using colour, you would have to make sure the search area didn't have any numbers though

Coh3n

2010-10-17 17:31:45

From: nickrules
Thats not the problem.
If the bot is searching the users inventory for an air rune (and lets say the have none), and the user has a death/chaos rune, its going to pick up that rune, and say that we do have air runes, when in reality, we don't.

That shouldn't happen if each main point color is different. I'll have to try it out if I get more time.

nickrules

2010-10-17 18:03:36

Ohhh. MSI uses DTMs to find items, herp derp. For some reason I thought i used colors, mybad…

Coh3n

2010-10-17 18:04:34

From: nickrules
Ohhh. MSI uses DTMs to find items, herp derp. For some reason I thought i used colors, mybad…

Ahh okay. :p