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 / Strange GetDeviceHeight when stored

Author
Message
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 3rd Sep 2013 13:34
Strange thing in AppGameKit Tier 1 Build 108 when I run it on Windows.

global GameHeight = GetDeviceHeight()
message (str(GetDeviceHeight()))
results in 480 but

global GameHeight = GetDeviceHeight()
message (str(GameHeight ))
results in 768

The setup files looks like this:
width=768
height=480

Any ideas?

Sincerely,
Max Tillberg
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 13:51
Is that code copied directly from your game? I am only guessing this is a coding mistake, otherwise it's a new bug (assuming you are using Beta 18 of V108).

Double check your code by creating a simple project containing only a test for this bug then post it on the bug board if it shows the same error.

"Here I am trying to do some good for the world..." - Fluffy Rabbit
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Sep 2013 13:59 Edited at: 3rd Sep 2013 14:05
i know that width / height turning with the device.
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 3rd Sep 2013 14:03 Edited at: 3rd Sep 2013 14:07
I think it as a code error as well but I can't find it. This is the complete code:



And the results is the DeviceWidth. Actuelly both GetDeviceWidth and GetDeviceHeight produces the same result (DeviceWidth). I also use fullscreen=0.

Sincerely,
Max Tillberg
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 14:10 Edited at: 3rd Sep 2013 14:15
Try this maybe?


I'm not sure why but this is how I tend to do it anyway...

EDIT: added more to the printed part and fixed blooper

"Everything should be made as simple as possible, but not simpler."
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 3rd Sep 2013 14:22
That works for some reason. Thanks. New problem. If I use
global deviceWidth = GetDeviceWidth() it results in 0.

Sincerely,
Max Tillberg
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 14:24
Assigning values to variables seems to be glitchy during declaration, just do this:


"Everything should be made as simple as possible, but not simpler."
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 3rd Sep 2013 14:31
And that worked fine. Thanks again, you have saved me twice today. Still I guess this is kind of bugs.

Sincerely,
Max Tillberg
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 14:41
Quote: "Still I guess this is kind of bugs."

Yes, I would consider these to be bugs. I'm pretty sure they are already logged at least. Not show stoppers but annoying.

"Everything should be made as simple as possible, but not simpler."
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Sep 2013 14:53
I would not consider that bug. Variables should not be instantiated with function calls, and most compilers will not let you do it. It's possible to declare this (legally) before the AppGameKit engine is actually properly started.

-- Jim - When is there going to be a release?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 15:44
C# lets you do it and that's a pretty strict language, the below code compiles fine for me:


I wasn't aware that other languages would not allow this as most of my experience is from C# or DBPro (which also allows it). From a learning point of view, why is it normally bad practice / "illegal"?

"Everything should be made as simple as possible, but not simpler."
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Sep 2013 16:17
I didn't say it was illegal. But is AppGameKit actually running at the declaration point?

-- Jim - When is there going to be a release?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Sep 2013 16:38 Edited at: 3rd Sep 2013 16:39
Quote: "I didn't say it was illegal."

Implicitly you sort of did
Quote: "It's possible to declare this (legally) before the AppGameKit engine is actually properly started"


Quote: "But is AppGameKit actually running at the declaration point?"

Not sure what you mean, I would imagine that AppGameKit is running from the very start... the only none runtime code is the setup.agc file I believe?

"Everything should be made as simple as possible, but not simpler."
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 4th Sep 2013 18:28 Edited at: 4th Sep 2013 18:31
Baxslash wrote:
Quote: "Yes, I would consider these to be bugs. I'm pretty sure they are already logged at least. Not show stoppers but annoying."


Yea, it's been reported before, as issue #35 in 2011.

Refer to:
http://code.google.com/p/agk/issues/detail?id=35

JimHawkins wrote:
Quote: "I would not consider that bug. Variables should not be instantiated with function calls, and most compilers will not let you do it."


At the very least the TIER1 compiler should produce a warning when it encounters this, if initializing-declarations of globals are not allowed to contain expressions.

Paul Johnston wrote:
Quote: "There won't be any compiler changes in 108 as Lee [who is the original author of the compiler] is focusing on Reloaded. I included the compiler stretch goal into version 2 so that I can justify devoting a couple of months to it and making it my own. It should then be much easier for me to make the fixes and feature requests that people have wanted from the BASIC language for version 2."


This should be the #1 top priority for AppGameKit V2, before anything else - because the TIER1 compiler is plain trash.

Cheers,
AgentSam
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Sep 2013 18:38
Quote: "At the very least the TIER1 compiler should produce a warning when it encounters this, if initializing-declarations of globals are not allowed to contain expressions."

I agree completely. If it's not supposed to be done then there should be a compiler error. I'm pretty sure it should work though but I was unaware it was not usually allowed.

Quote: "the TIER1 compiler is plain trash"

Not sure I agree with you there, it has a few minor bugs but generally it works without problems (for me at least). I actually can't think of any other issues I've come across.

AgentSam, just once I'd like to see a post from you saying something positive about AppGameKit, but I'm weird like that

"Everything should be made as simple as possible, but not simpler."
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 4th Sep 2013 18:54
Have you tried the following:

@baxslax: I partially agree with AgentSam. The compiler is not trash, it works well, I am not accustomed to criticize the work of clever (much more than me) people such as Lee, Paul, etc, but in the past I have experienced a lot of problems with logic expressions management and array assignment, that I promptly forward to TGC. I am not good at finding links, but trust me...
Anyway, to be positive, such bugs have been corrected. Moreover now the compiler is extremely fast and this is very good thing.
The UDT bugs has been corrected, etc.
I do not know if the right way is Paul to rewrite the compiler, he probabily has got too many things to do.
Scary Little Rabbit
15
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 7th Sep 2013 19:21
it was be pretty good for me, if AppGameKit would do something alike:

or


and sorry for offtop, but I want to see AgentSam as member of TGC.

error #1:
"too many stars, too many stares. disembody."
WIP: MIND!! | free fonts for your AGKs
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Sep 2013 14:46 Edited at: 8th Sep 2013 15:04
Scary Little Rabbit wrote:
Quote: "It would be nice, if AppGameKit allowed something like:
#constant a 100
global b a
"


You can do the following:



Scary Little Rabbit wrote:
Quote: "
or

function f()
a = 10
endfunction a

global b f()
"


Since AppGameKit does not currently allow initializing-declarations of globals using expressions, you will need to do the following instead:



Here's a slightly more comprehensive example:



Scary Little Rabbit wrote:
Quote: "
and sorry for offtop, but I want to see AgentSam as member of TGC.
"


I'm not sure what you mean by "member of TGC" -- but I know TGC can't afford to hire any more employees at this point, and I already have a job.
They had to let Baxslash go because they couldn't afford to keep him on the payroll, and I don't think they're looking to hire anyone at the moment.

(I'm currently quite happy with the progress Paul has been making with AppGameKit - I have more respect for him, than any other TGC employee.)

Cheers,
AgentSam
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Sep 2013 18:58
Quote: "AgentSam, just once I'd like to see a post from you saying something positive about AppGameKit, but I'm weird like that"

Quote: "(I'm currently quite happy with the progress Paul has been making with AppGameKit - I have more respect for him, than any other TGC employee.)"

That happened quicker than I thought I can die happy...

"Everything should be made as simple as possible, but not simpler."
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Sep 2013 19:20
Quote: "That happened quicker than I thought "


It must have been just a reflection of your own positive attitude.. Some of it rubbed off on me.

Cheers,
AgentSam
Greenster
19
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 8th Sep 2013 19:43 Edited at: 8th Sep 2013 19:45
Why do people bother criticizing anymore? For example, this bug is years old and it's suggested you're trying to hurry things..

Did I misspell something this time staff?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Sep 2013 20:01
From Lee on 7-Oct-2011 (issue #35):
Quote: "Runtime declarations to be looked at in the future if community wants this."


But, until four days ago (4-Sep), no one responded in that issue. So it was dropped.

It isn't a bug. It's a usage thing that the writer of the compiler did not anticipate people would do and so did not program for it.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 8th Sep 2013 20:31
Quote: "Did I misspell something this time staff?"


No. Amazing ability to post, though, for somebody who left the forum.

-- Jim - When is there going to be a release?
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 8th Sep 2013 22:50
@AgentSam, you are really Her Majesty MI5 007 Secret Agent. You have discovered the payroll troubles of TGC. Pls tell me how long my company shall be able to pay my modest salary, in Italy we have the lowest wages except for Portuguese people (and Greek now), but nobody knows about the futurr
Jokes apart, the AppGameKit help states clearly that dynamic variable assignments (with functions) are not allowed. So why have we started this discussion?
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 8th Sep 2013 23:34
MarcoBruti wrote:
Quote: "you are really Her Majesty MI5 007 Secret Agent. You have discovered the payroll troubles of TGC."


Marco, I just read what has been posted on this forum. Careful reading yields a lot of information, but there's nothing mysterious or secretive about it. And surely most people know that TGC is a very small - sometimes struggling - company. That's no news.

The "payroll" information is based on what has been posted before.

Cheers,
AgentSam
Scary Little Rabbit
15
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 9th Sep 2013 09:11
Quote: "You can do the following"
AgentSam, I know that I can and globals must be registered before functions, I just try to express that I want this "runtime declarations".

Quote: "I'm not sure what you mean by "member of TGC""
one of team, employee. I like the way you dance.
Quote: "TGC can't afford to hire any more employees"
TGC must hire some employees, as I see.

error #1:
"too many stars, too many stares. disembody."
WIP: MIND!! | free fonts for your AGKs
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 9th Sep 2013 14:02
@Scary Little Rabbit:

Thanks for the article link. I enjoyed reading it, and I think I'm going to read the rest of his articles.

Overall this thread has now gone completely offtopic. Actually, it went offtopic as soon as we noticed those initializing-declarations in the original post. Since then, it was clear that this thread isn't really about the "GetDeviceHeight" function, which works just fine. It's the assignments that don't.

So here's one more offtopic followup. Rabbit, I opened up your website, and noticed you've made a bitmap font generator for AGK. Is the source-code to this tool available? (Looks like it was made with DBP.)

Cheers,
AgentSam
Scary Little Rabbit
15
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 10th Sep 2013 08:18 Edited at: 10th Sep 2013 08:18
AgentSam, try http://joelonsoftware.com also.

Quote: "Is the source-code to this tool available?"
currently not. do you want some?
Quote: "it was made with DBP"
indeed.

error #1:
"too many stars, too many stares. disembody."
WIP: MIND!! | free fonts for your AGKs
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 10th Sep 2013 09:15
@Scary Little Rabbit:

Quote: "currently not. do you want some?"


Well, source is always a big plus!
So, yea, if you find the time to include it in the package,
I'll be sure to check it out. I'm sure others would be
interested in it also.

Cheers,
AgentSam

Login to post a reply

Server time is: 2024-11-24 20:02:49
Your offset time is: 2024-11-24 20:02:49