Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetTextFontImage in a function

Author
Message
Max Tillberg
18
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 6th Sep 2013 18:18
Do you know why SetTextFontImage does not work in a function? I define a fontimage as
bell18bold = LoadImage ("bell18bold.png")
and then tries create a new text as
SetTextFontImage(tempid, bell18bold)
inside a function but it is not used. I use the latest beta and Tier1.

Sincerely,
Max Tillberg
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Sep 2013 18:31
Did you declare bell18bold to be a global variable inside the function?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Max Tillberg
18
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 6th Sep 2013 18:36
I defined it outside the function and did not manage to define it as global, I thought that all fontimages was global.

Sincerely,
Max Tillberg
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Sep 2013 18:42
Font images are loaded into memory and can be accessed anywhere using the correct image ID. You are assigning the value of that ID to a variable called "bell18bold" which has not been declared as global.

Add this before you load the image:


"Everything should be made as simple as possible, but not simpler."
Max Tillberg
18
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 6th Sep 2013 18:55
I feel like a complete idiot. Thanks for helping me.

Sincerely,
Max Tillberg
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Sep 2013 18:59
More often than not it's the simple stuff that trips us all up

"Everything should be made as simple as possible, but not simpler."
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Sep 2013 19:08
Yup, simple stuff that is so easy to overlook until a second pair of eyes does it.

Like that flippin' missing '4' in my iOS plist file.......grmble grmble

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-05-09 20:05:22
Your offset time is: 2024-05-09 20:05:22