Page 1 of 1

[01 Oct 2009] Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by Paolo Canonici
Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 01 Oct 2009 18:13:27 +0200

Hi,

I need to free the resources by my own. Is there a way to know if a resource (i.e. a brush) is actually loaded at the specified id?

Regards, Paolo.

[02 Oct 2009] Re: Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 02 Oct 2009 12:04:04 +0200
Hi, I need to free the resources by my own. Is there a way to know if a resource (i.e. a brush) is actually loaded at the specified id?
What IDs are you using? Are you using number or new Hollywood 4.0 style IDs? (i.e. passing NIL as number and getting the return value), i.e.

Code: Select all

my_brush = LoadBrush(Nil, "test.iff")
DisplayBrush(my_brush, 0, 0)

[02 Oct 2009] Re: Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by Paolo Canonici
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 02 Oct 2009 16:52:49 +0200

I'm using the old style, providing explicit IDs.

[02 Oct 2009] Re: Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 02 Oct 2009 21:54:06 +0200
Hi Andreas, I'm using the old style, providing explicit IDs.
So you want to check if a certain explicit ID contains a brush? There's no convenient way for this, I'm afraid, but you can use a little work around, i.e.

Code: Select all

/* returns True if specified id is a brush */
Function p_CheckBrush(id)

Local brush_there = True

ExitOnError(False)
GetAttribute(#BRUSH, id, #ATTRWIDTH)
If GetLastError() <> 0 Then brush_there = False
ExitOnError(True)
Return(brush_there)

EndFunction
This should do the job. It's a little bit awkward because it disables/enables the automatic error handler but it should do what you want :)

[04 Oct 2009] Re: Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by NubeCheCorre
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 4 Oct 2009 12:34:40 +0200

Hi Andreas :-)

i was reading this topic about the ID, so it is better use the new ID way ? why ?

Thanks Davide

[05 Oct 2009] Re: Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 05 Oct 2009 10:47:51 +0200
Hi Andreas :-)

i was reading this topic about the ID, so it is better use the new ID way ? why ?
It's only useful if you've a larger project. Using hard-coded IDs can get quite bothersome in this case so you might want to use the new IDs. For smaller projects I find it easier to use hard-coded IDs like 1,2,3,4 :)

[05 Oct 2009] Re: Resource loaded?

Posted: Sat Jun 13, 2020 5:32 pm
by NubeCheCorre
Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 5 Oct 2009 11:51:36 +0200

OK thanks for the reply :-)