SRL Archive - General

Adding Attribute to TOjbect record


NCDS

2011-01-15 20:06:45

I feel it would be beneficial to have a SearchBox attribute added to the TObject records.

My reason for this is for instances like DB bank. The 'fake booths' off to the right side are the same colors etc. as the real booths on the left side. By adding a SearchBox attribute, we could have it only search the left side of the screen when searching for the bank.

I'm sure there are many other instances where this would be useful as well.

This is already supported in MSI_FindObjectsTPA, which is the base function for all our current object finding. We would simply need to change SearchBox.x1, SearchBox.y1 etc. to MSI_Objects[objID].Box.x1, MSI_Objects[objID].Box.y1 etc.

Would be implemented to the object record as simple as:

Box := IntToBox(x1, y1, x2, y2);

Also, if there is no need to have a specific search box for something, we can have it set with the rest of the defaults to MSBox.

Any objections?

Gu3st...

2011-01-16 07:41:55

The only downside of this is that the compass would have to be aligned in a specific angle for it to work, but I think it's worth it

Sir R. M8gic1an

2011-01-16 08:25:57

Add CompassAlignment to the TOBjectRecord too and do some math to figure out where u should be searching for ur shit.


Sounds great.

~RM

Coh3n

2011-01-16 17:34:36

Yes. I'd say have MSI_FindObjectsIn use MSBox unless TObject.SearchBox has been defined. That way we don't have to update every object record with SearchBox := MSBox (not that it would take long :p).

Sir R. M8gic1an

2011-01-16 17:38:57

we can just make MSBox the default value for TObject.Searchbox :)

~RM

Coh3n

2011-01-16 17:43:28

From: Sir R. Magician
we can just make MSBox the default value for TObject.Searchbox :)

~RM

Yeah you're right, I thought of that after I posted. Can just loop through every object and set it. :p

Sir R. M8gic1an

2011-01-16 17:49:57

From: Coh3n
Yeah you're right, I thought of that after I posted. Can just loop through every object and set it. :p


I still really think we should have loading and unloading of objects the way SRL does with bitmaps.

I know it's not much memory that is taken up by these objects, but we do have loads of objects.

Coh3n

2011-01-16 18:24:50

From: Sir R. Magician
I still really think we should have loading and unloading of objects the way SRL does with bitmaps.

I know it's not much memory that is taken up by these objects, but we do have loads of objects.

I thought SRL loaded them in SetupSRL?

Sir R. M8gic1an

2011-01-16 18:40:46

From: Coh3n
I thought SRL loaded them in SetupSRL?


Don't we load all the objects?

Or just the necessary ones?

Been a long time, sorry :p

~RM

Coh3n

2011-01-16 18:46:29

From: Sir R. Magician
Don't we load all the objects?

Or just the necessary ones?

Been a long time, sorry :p

~RM

We load all of them, but I suppose only the necessary ones could be loaded. Even though I don't think it would make a difference.

E: Looking at TMSObject, it seems to me that most of the Anim attributes should be set to True since we would want it to return false if the player isn't animating, correct? Also, we could probably get rid of BadColors and BadColorsTolerance as AFAIK they're not being used.

E2: Also, it came up in Markus's thread. I like the idea of adding a MaxWait to TMSObject so that will be the max time to wait for it to be gone. He brought up a good point about it waiting a minute if TrackObject was tracking the wrong rock.

Sir R. M8gic1an

2011-01-16 19:02:46

From: Coh3n
We load all of them, but I suppose only the necessary ones could be loaded. Even though I don't think it would make a difference.

E: Looking at TMSObject, it seems to me that most of the Anim attributes should be set to True since we would want it to return false if the player isn't animating, correct? Also, we could probably get rid of BadColors and BadColorsTolerance as AFAIK they're not being used.

E2: Also, it came up in Markus's thread. I like the idea of adding a MaxWait to TMSObject so that will be the max time to wait for it to be gone. He brought up a good point about it waiting a minute if TrackObject was tracking the wrong rock.


Careful cus it varies highly depending on rock, pick, level and luck.

Markus has a big mouth but he most likely hasn't solved this any better than we have.

Coh3n

2011-01-16 19:06:42

From: Sir R. Magician
Careful cus it varies highly depending on rock, pick, level and luck.

Markus has a big mouth but he most likely hasn't solved this any better than we have.

I know, but I still like the idea; however, I would rather get the IsMining part improved. Maybe only add something like this if it's absolutely necessary.

if not Character.Animation = MINING_ANIMATION then break; ?

this is a good start.

I'd want to start adding reflection to MSI if that's ok with you?

I'd add everything inside wrappers and set it up as an extra.

Also, extras should all go in one file.

If the extra needs a constant, leave it in the extra file.

~RM

Nava2

2011-01-16 19:49:23

Couldn't you just do:

if (object.box <> nil) then
searchbox := object.box
else
searchbox := defaulttttttttttttttt

Coh3n

2011-01-16 19:57:11

From: Nava2
Couldn't you just do:

if (object.box <> nil) then
searchbox := object.box
else
searchbox := defaulttttttttttttttt

That's what I was getting at in my first post.

Sir R. M8gic1an

2011-01-16 20:03:01

U still need to track the object's box.

~RM

Coh3n

2011-01-16 20:26:46

From: Sir R. Magician
U still need to track the object's box.

~RM

Yeah, that's not what this was going to be used for though. I guess it could, but didn't TrackObject already do all that?

NCDS

2011-01-16 20:39:42

From: Coh3n
I know, but I still like the idea; however, I would rather get the IsMining part improved. Maybe only add something like this if it's absolutely necessary.

if not Character.Animation = MINING_ANIMATION then break; ?

if not IsAnimating then ? Why doesn't anyone ever use Animation.scar :confused:

My original concept with this was sort of like a 'bad colors' or 'bad box' type of thing. For instance, my example in the first post. The draynor bank booths will always be on the left side of the screen when standing in the bank, so we only need to search the left side.

The same concept could be applied to most any bank and also many places where your searching for an object.

I don't see a reason Reflection would be needed for any of this?

From: Coh3n
Yeah you're right, I thought of that after I posted. Can just loop through every object and set it. :p

Exactly, we would just set it the same as we do any other defaults, really.

Coh3n

2011-01-16 20:44:05

From: NCDS
if not IsAnimating then ? Why doesn't anyone ever use Animation.scar :confused:

My original concept with this was sort of like a 'bad colors' or 'bad box' type of thing. For instance, my example in the first post. The draynor bank booths will always be on the left side of the screen when standing in the bank, so we only need to search the left side.

The same concept could be applied to most any bank and also many places where your searching for an object.

I don't see a reason Reflection would be needed for any of this?


Exactly, we would just set it the same as we do any other defaults, really.

I wonder if RM meant to edit my post like that? :rolleyes:

This was my plan http://villavu.com/forum/showpost.php?p=768943&postcount=4

NCDS

2011-01-16 20:53:25

From: Coh3n
I wonder if RM meant to edit my post like that? :rolleyes:

This was my plan http://villavu.com/forum/showpost.php?p=768943&postcount=4


That also makes us rely on Reflection though, which is something I thought we had agreed to never do. I don't really find that to be a good idea, especially with a good chance of having a large RS update soon very capable of breaking Reflection again.

marpis did a great job with Animation.scar and I would personally like to see more of it used. I would be very surprised if we couldn't make things work just as effectively as Reflection by using Animation.scar properly.

However, I'm not opposed at all to start adding in more Reflection failsafe's. :)

Coh3n

2011-01-16 20:57:09

From: NCDS
That also makes us rely on Reflection though, which is something I thought we had agreed to never do. I don't really find that to be a good idea, especially with a good chance of having a large RS update soon very capable of breaking Reflection again.

marpis did a great job with Animation.scar and I would personally like to see more of it used. I would be very surprised if we couldn't make things work just as effectively as Reflection by using Animation.scar properly.

However, I'm not opposed at all to start adding in more Reflection failsafe's. :)

It wasn't meant to rely on reflection? It did the color check first, then just double checked with reflection. I maybe should have put that in defines. But when that reflection one failed, that's when we could automatically generate the TAnimation record. :D

But I agree with you, I bet with Animation.scar we could make it work just as well as reflection (it wouldn't be 100% because there are certain situations that may make it mess up, but still 95%+).

NCDS

2011-01-16 20:59:28

From: Coh3n
It wasn't meant to rely on reflection? It did the color check first, then just double checked with reflection. I maybe should have put that in defines. But when that reflection one failed, that's when we could automatically generate the TAnimation record. :D

But I agree with you, I bet with Animation.scar we could make it work just as well as reflection (it wouldn't be 100% because there are certain situations that may make it mess up, but still 95%+).


What you posted won't result true unless r_IsAnimating returns true though?

Either way, no big deal, I know what you mean. :p

Coh3n

2011-01-16 21:02:00

From: NCDS
What you posted won't result true unless r_IsAnimating returns true though?

Either way, no big deal, I know what you mean. :p

Yeah I wrote that up in like 30 seconds. :p

Gu3st...

2011-01-17 06:05:19

From: Coh3n
Also, extras should all go in one file.

If the extra needs a constant, leave it in the extra file.

~RM
Say whaaat? Do you mean that the extras has a file in common, or to merge all the extras into one file?

Sir R. M8gic1an

2011-01-17 06:09:03

From: Zyt3x
Say whaaat? Do you mean that the extras has a file in common, or to merge all the extras into one file?


I mean that each extra has their own file and all the shit belonging to that extra should be within the file as far as possible

Gu3st...

2011-01-17 07:30:36

From: Sir R. Magician
I mean that each extra has their own file and all the shit belonging to that extra should be within the file as far as possible
Ah right :) I support that

Coh3n

2011-02-10 17:08:26

NCDS, was this ever added?

NCDS

2011-02-10 18:00:34

From: Coh3n
NCDS, was this ever added?


No, because I fixed the banking bug and that's what this was mainly for. Though, I can add it in while I'm doing some other code changes if you'd like me to still.

Coh3n

2011-02-10 18:29:05

From: NCDS
No, because I fixed the banking bug and that's what this was mainly for. Though, I can add it in while I'm doing some other code changes if you'd like me to still.

Come back to it if necessary. We shouldn't mess with something that's currently working.

Gu3st...

2011-02-11 12:13:36

From: Coh3n
Come back to it if necessary. We shouldn't mess with something that's currently working.
If we can make something better, then imo we should do it

Coh3n

2011-02-11 14:40:36

From: Zyt3x
If we can make something better, then imo we should do it

Yeah, and we will.. eventually. It's more important to fix current issues/finish current projects than mess with something that's currently working just fine.

Gu3st...

2011-02-11 14:47:37

From: Coh3n
Yeah, and we will.. eventually. It's more important to fix current issues/finish current projects than mess with something that's currently working just fine.
That's true.. :)

NCDS

2011-03-01 20:26:31

This has been added. All are currently set to carry the values of MSBox by default.

Should help with fixing a few existing bugs. :)

Coh3n

2011-03-01 20:35:31

From: NCDS
This has been added. All are currently set to carry the values of MSBox by default.

Should help with fixing a few existing bugs. :)

I'm not sure why, but look at the diff. https://github.com/SRL/MSI/commit/bc875da8829f932d8b5d4f5f0f25be179e68cf7c

So I can't see exactly what you changed. It's not the first time it happened (I actually did the same thing with the player remote yesterday by accident). So just be careful and look at the diff before committing.

E: And as a result, I won't be able to push my changes to the main repository because they won't merge properly.

NCDS

2011-03-01 20:38:49

From: Coh3n
I'm not sure why, but look at the diff. https://github.com/SRL/MSI/commit/bc875da8829f932d8b5d4f5f0f25be179e68cf7c

So I can't see exactly what you changed. It's not the first time it happened (I actually did the same thing with the player remote yesterday by accident). So just be careful and look at the diff before committing.


Yeah my bad, I'm still getting used to Git so I just copied and pasted the LoadObject function. Though I think I just figured everything out for the most part.

All I did was add the attribute in Globals and put SearchBox := MSBox; in each Object. Nothing special/hard to follow at all.

Coh3n

2011-03-01 20:42:05

From: NCDS
Yeah my bad, I'm still getting used to Git so I just copied and pasted the LoadObject function. Though I think I just figured everything out for the most part.

All I did was add the attribute in Globals and put SearchBox := MSBox; in each Object. Nothing special/hard to follow at all.

Okay so you didn't modify the actual object finding procedures at all?

NCDS

2011-03-01 22:08:04

From: Coh3n
Okay so you didn't modify the actual object finding procedures at all?


Going through that stuff now

Edit: Plugged this into the Banking and pushed to my repo while I test it, then I'll push to the main one.

@Coh3n: Want to talk to you when your back about adding it to Objects before I do anything with that.

Coh3n

2011-03-02 01:19:04

From: NCDS
Going through that stuff now

Edit: Plugged this into the Banking and pushed to my repo while I test it, then I'll push to the main one.

@Coh3n: Want to talk to you when your back about adding it to Objects before I do anything with that.

You didn't push it? https://github.com/NCDS/MSI/tree/

When you do, though, I'll be testing it for sure. I also had this happen just now on all 4 of my players, which is weird because earlier today the booths were completely coloured in my SMART. I'll see if the colours were changed in the fiasco we had earlier. E: Yeah, somehow it went back to before I updated it; although I'm pretty positive I made sure those were changed. Oh well. E2: Changes pushed to my repository.