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 / AGK Version 2 Alpha 9

Author
Message
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 16th Nov 2014 15:41 Edited at: 17th Nov 2014 00:08
Ah, Matty H you legend that is probably it. I assumed you could still receive ads even without creating a campaign. I'll give that a go tonight. Thanks!

EDIT: Yep, that was it!! Thanks again Matty H! Paul, apologies, false alarm
dooz
18
Years of Service
User Offline
Joined: 22nd Sep 2005
Location:
Posted: 16th Nov 2014 21:40
I'm calling parse.com using HTTPRequest

From what I can find out, it has a limited HTTP function set. It can only do GET and POST, and it doesn't support HTTP Headers. This makes it very hard to use a backend service like parse.

I have managed to connect using the the following Url structure (as proposed by parse themselves):

myAppId:javascript-key=@api.parse.com

and have managed to do GET requests.

However, now I'm trying to do a create with POST. The issue I've hit is I that is requires a JSON content type. That is, I need to set Content-Type to "application/json". Since I can't access HTTP Headers, it appears I cannot do it.

Is there anyway to simulate the "Content-Type" header?

Is there a way to do PUT and DELETE request types?

When will these features be coming?

As these are fundamental to using any kind of REST back-end service.

Thanks!
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 17th Nov 2014 00:39
The manual says that for an editbox to accept Extended characters you have to use setEditBoxExtendedFontimage(editbox,0)

It doesn´t. I still get the "This edit box does not support extended characters" error.

I never want what I know.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Nov 2014 18:56
@HockeyKid - Try the following PlayAnimation function. Using both GetFrameTime and Timer for timing was incompatible because GetFrameTime assumes no frame will take longer than 0.2 seconds


Quote: "on mac i did a test and infact need to set mouse position once every 8 to 10 syncs just to register any mouse movement before reseting the mouse position."


It looks like Mac doesn't send the raw mouse position but some smoothed version. I tried the following code to try and work around it but it doesn't produce a nice result

so I don't know how to fix this.

Quote: "can we get the splash images added to the exporter?"


It's on my list, but you can do it manually by opening the AGK2.app file with right click show package contents, browsing to Contents/Resources/share/geany/ios/source then show contents on AppGameKit 2 Player.app and place your Default.png files in there.

Quote: "in alpha 9 the export APK option ask me for a keystore password even if i don't provide any signing info"


If the Keystore File edit box has any text in it then it assumes you are signing. I've fixed the tool tips for the next version.

Quote: "Is there anyway to simulate the "Content-Type" header?"


Currently no, it's on my todo list.

Quote: "The manual says that for an editbox to accept Extended characters you have to use setEditBoxExtendedFontimage(editbox,0)"


I can't see where it says this, it should say you must use a value other than 0.
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 17th Nov 2014 20:00
Minor issue... When exporting as an APK, the 'App Name' claims to only allow 'A-Z 0-9 spaces and underscore',

Quote: "App name contains invalid characters, must be A-Z 0-9 spaces and underscore only"


This is actually incorrect, my already published apps use '-' in the App Name.
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 17th Nov 2014 21:57 Edited at: 17th Nov 2014 21:58
@ Paul

setEditBoxExtendedFontImage() manual:
"Sets the extended font image to use for this edit box, must have been previously loaded with LoadImage(). Use 0 to return the edit box to its default extended font. If you do not set this image the edit box will not accept extended characters such as £ é á etc."

-- 0 to return the edit box to its default extended font.

I thought editboxes used the same font image as the text or print command...
The extended fonts works with print and text without your own font image....

I never want what I know.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 17th Nov 2014 22:38 Edited at: 17th Nov 2014 22:39
Quote: "
Quote: "in alpha 9 the export APK option ask me for a keystore password even if i don't provide any signing info"

If the Keystore File edit box has any text in it then it assumes you are signing. I've fixed the tool tips for the next version."


Yes but ... i have checked for each signing field and they are all empty (and no blank spaces). On Mac (alpha9) i can export without signing, but not on windows (alpha 9 too) which reports me an alias name or password problem (screenshot attached)...

Maybe a parallel installation of eclipse (which i have) and an existing keystore could cause a problem ?

--------------

Attachments

Login to view attachments
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 17th Nov 2014 22:39
Never seen this problem...

-- Jim - When is there going to be a release?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 18th Nov 2014 01:21
Quote: "When exporting as an APK, the 'App Name' claims to only allow 'A-Z 0-9 spaces and underscore'"


I was perhaps a bit strict in the letters allowed, it's a left over from the online version where I had to be concerned about what characters were getting passed to the command line of an active server. I'll add dash to the list and consider whether to remove the limit altogether.

Quote: "0 to return the edit box to its default extended font"


I'll change the help to mention that using 0 removes the extended font image because whilst it does return it to default the default image does not have any extended characters for edit boxes. You can load the default image "asciiExt.png" and use that if you like, which is used by the print command, but it won't look as good.

Quote: "On Mac (alpha9) i can export without signing, but not on windows (alpha 9 too) which reports me an alias name or password problem (screenshot attached)"


The message about the password is just me guessing at what the most likely problem is, the error code 258 is the actual problem. However the documentation for the jarsigner command states that valid error codes are 0-255 so I don't know what that value means. I'll make the IDE ignore it and attempt to continue and see what happens.

The default keystore the IDE uses is in "Tier 1/Editor/data/android/debug.keystore" with the password "android" the alias "androiddebugkey" and the alias password "android", does it work if you try these signing values manually?
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 18th Nov 2014 01:52
@ Naphier

Quote: "You can load the default image "asciiExt.png" and use that if you like"


Ah. Thank you. Since I´m going for retro and pixelart the built in fonts is fine right now. Good to know that "AsciiExt.png" and "Ascii.png" works with loadImage()

I never want what I know.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 18th Nov 2014 06:14 Edited at: 18th Nov 2014 06:15
@paul

i had allot of trouble trying to make a new ouya player using eclipse... so i gave up and tried the one you now have built into agk2

looks good,works good but do we need to enter all that data in everytime we go to export? maybe it would be nice to save settings for each program we have open seperately for easy updating. This way i can remember what version number i was on and so on....

hopefully you can set it up so it remembers last export entry for each app program created.

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 18th Nov 2014 08:44
Quote: "
Quote: "On Mac (alpha9) i can export without signing, but not on windows (alpha 9 too) which reports me an alias name or password problem (screenshot attached)"

The message about the password is just me guessing at what the most likely problem is, the error code 258 is the actual problem. However the documentation for the jarsigner command states that valid error codes are 0-255 so I don't know what that value means. I'll make the IDE ignore it and attempt to continue and see what happens.

The default keystore the IDE uses is in "Tier 1/Editor/data/android/debug.keystore" with the password "android" the alias "androiddebugkey" and the alias password "android", does it work if you try these signing values manually?"


Same Thing (screenshot attached). Strange. I have also tried with my own keystore but same issue (error 258).

Also tried executing as admin (Windows 7).

--------------

Attachments

Login to view attachments
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 18th Nov 2014 13:14
same issue on another Win7 x64 computer with alpha 9 (maybe the x64 cause the problem ?)

--------------
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 18th Nov 2014 16:55
Quote: "do we need to enter all that data in everytime we go to export?"


Currently it will remember the dialog contents whilst the IDE remains open, but adding the settings to the project file is on my todo list.

Quote: "same issue on another Win7 x64 computer with alpha 9 (maybe the x64 cause the problem ?)"


I'm running Windows 7 64-bit so I don't think that is the problem. Strange how it happens for you on another computer but not on anyone else's computer.
Retrific
9
Years of Service
User Offline
Joined: 26th Aug 2014
Location: Horwich, UK
Posted: 18th Nov 2014 17:25 Edited at: 18th Nov 2014 17:55
I have been able to export to APK without any problems, using a keystore from Eclipse, on Win8 x64.

Edit: Forgot to say with Alpha 9.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 18th Nov 2014 17:35
I just installed alpha 9, then opened my agk project, and opens the export AppGameKit window. Nothing else.

I will try on another win7 x64 without eclipse and JRE at all.

--------------
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 18th Nov 2014 21:06
Quote: "Currently it will remember the dialog contents whilst the IDE remains open, but adding the settings to the project file is on my todo list."


on the todo list... sweet!

thanks paul

MikeHart
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 18th Nov 2014 23:12
@Paul:
LoadSpriteShader seems not to work. A shader loaded with LoadShader works, but not when I only take the pixel shader with LoadSpriteShader.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 19th Nov 2014 01:19 Edited at: 19th Nov 2014 01:21
Quote: "
Quote: "same issue on another Win7 x64 computer with alpha 9 (maybe the x64 cause the problem ?)"

I'm running Windows 7 64-bit so I don't think that is the problem. Strange how it happens for you on another computer but not on anyone else's computer."


Ok problem identified.

My AppGameKit Projects are located in my DropBox folder. When the default signing process create and use tmp files (and especially the projectname.zip.sig file), the DropBox agent daemon is trying (and achieve) to access the file to synchronize it. I think there is a read/write access concurrency between signing process and DropBox which monitors filesystem changes.

if i specify a path for the "output file location" (APK Path) outside the dropbox folder, it works correctly (if i previously delete any residual zip.sig file inside the Project directory if problem has previously occured).

On MacOS it seems this concurrency (DropBox & APK Signing) doesn't create any issue.

I would have preferred a real and local temp directory instead of the project directory itself (the windows %TEMP% system dir for example ?) which would prevent to synchronize all the tmp files uselessly when used with a *box/drive* software (DropBox/Box/Google Drive/One Drive etc..)...

--------------
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Nov 2014 17:24
Quote: "LoadSpriteShader seems not to work. A shader loaded with LoadShader works, but not when I only take the pixel shader with LoadSpriteShader. "

I get the same issue.
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 20th Nov 2014 22:45 Edited at: 20th Nov 2014 22:46
Possibly a small glitch here... I've noticed that if you set the Window Size to something bigger than the default 1024/768 you get a quick flash of white border (on the side/s which is larger than the default). Pretty difficult to explain, but if you run this code you'll see what I mean.

This is only an issue on Windows as I suspect this is due to the fact we don't have a setup file anymore so AppGameKit starts by default at 1024/768 until it hits the SetWindowSize command...

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Nov 2014 10:49
Am I right in assuming that the Steam release is an actual release and not a beta? Is this AppGameKit 2.0?

-- Jim - When is there going to be a release?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 21st Nov 2014 12:05
I just enabled my key
Go AGK2 Go!

MikeHart
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 21st Nov 2014 12:09
Quote: "Am I right in assuming that the Steam release is an actual release and not a beta? Is this AppGameKit 2.0?"


Guess they went from Alpha to release right away. Or is it tagged as an Early Access product?
RickV
TGC Development Director
24
Years of Service
User Offline
Joined: 27th Apr 2000
Location: United Kingdom
Posted: 21st Nov 2014 12:55
It's the same build as you are using. There is no Early Access in the software section on Steam. Software titles are expected to be improved and patched as time goes on.

We felt that the builds were so good that the time was right to spread the sales net on to Steam. The work on new features will of course continue (once Paul has had some well deserved time off!)

Rick

Development Director
TGC Team
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 21st Nov 2014 13:51
You should consider updating the 'Guides' section of the manual that links from Steam. These are the things that are important for new users.

I only clicked the 1st link ' IDE' and it was information about the old IDE.

Also not sure that the iOS guide is up to date.
RickV
TGC Development Director
24
Years of Service
User Offline
Joined: 27th Apr 2000
Location: United Kingdom
Posted: 21st Nov 2014 15:30
Hi,

Yes we're in the process of updating these guides.

Rick

Development Director
TGC Team
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 21st Nov 2014 17:42 Edited at: 21st Nov 2014 18:28
I found a problem with SetSpriteActive. Please consider the following code:



On my PC, the first sequence of loops takes 12 seconds, then with all the sprites de-activated (which I would expect to speed up the render process MASSIVELY) the 2nd set of loops takes 3 seconds LONGER to process! Something is definitely broken with setspriteactive (unless I have completely misunderstood the purpose of this command).

EDIT:

Replacing SETSPRITEACTIVE with SETSPRITEVISIBLE does what I expected SETSPRITEACTIVE to do (i.e. completely removes the sprite from the render process). With the sprites invisible, the second set of loops blasts through at full frame rate.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Nov 2014 19:37
The help says it switches off physics and animation, but not that is doesn't render.

-- Jim - When is there going to be a release?
sdl
AGK Developer
12
Years of Service
User Offline
Joined: 5th May 2012
Location: Germany
Posted: 21st Nov 2014 21:34
Bug...
Hi Paul, can you fix SetGlobal3DDepth ?
This Command is not working...

Thanks Sascha
dooz
18
Years of Service
User Offline
Joined: 22nd Sep 2005
Location:
Posted: 23rd Nov 2014 21:35
I'm new to AGK2, been playing with it a bit it looks great.

I don't understand a few things, please point my in the right direction if I've missed it.

I'm running on a Mac and can see how you can create Android and iOS apps (both are obvious from the menus in the IDE).

However, how you do create a stand-alone app for the Mac app store?

Also, I just activated the steam key. Why do we need a specific version of AGK2 running from the Steam client? How do you create a Steam app?

Sorry if all of this is somewhere else or in documentation, but I have yet to find it.

Thanks!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Nov 2014 23:17
Welcome to the forums.
For questions like these, I would suggest you start a new thread, otherwise it will get lost amongst other discussions, and it will also help other newcomers if the questions have their own thread.

It's not yet possible to create a Steam App. Having said that, Steam have very high standards and a game of their standards is likely to be 12 months or more of work. Games for Desktop, Android and iOS can be made in as a little as a few days (or even hours for a simple game).

I haven't delved into Mac OS yet, somebody will be along shortly and answer that one I'm sure.

Quidquid latine dictum sit, altum sonatur
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 24th Nov 2014 12:10
@Paul :
I think there are some issues with RenderToImage()


1) [win/android] SetRenderToImage() and drawbox()/DrawEllipse()/DrawLine()

I have "blue" square on the box and the ellipse with this code :

With that code, I have this result :


Another result, there are some white lines inside the box or the ellipse (on my appli, it should a simple gradient) :



2)[win/android] SetRenderToimage() and sprite (with alpha)
here is a simple image with the issue :


Test :
Simply load an image and draw it as sprite on a renderToImage

3)[Android] SetRenderToImage() and Home key
If we use SetrenderToImage() and touch the home key (on android), the Image (made with CreateRenderToImage()) is cleared and bugged (it become a black image,and we can't draw on it or clear it).

Simple test : on android, run your bloom shader example, and touch the homekey, then touch the "opened application key" :


Your image created with CreateRenderToImage() become black and unusable.

I have tried to use GetResumed and create a new image, but in some case, we have to keep the previous Image created with CreateRenderToImage() (for exemple, on a painting appli, photo appli...)


4)[Android] SetRenderToImage() and GetChosenImage()

It's the same issue as describe at 3)

If we use a Image created with CreateREnderToImage() and want to draw a picture on it (photo for example) loaded with GetChosenImage(), the Image created with CreateRenderToImage()isn't working after choosing the picture.
It became black and it's impossible to clear it.



I hope those explications are usefull. I don't know if that's a bug or if only I have to do some thing to correct that issue.

http://www.dracaena-studio.com
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 24th Nov 2014 12:29 Edited at: 24th Nov 2014 14:29
I can also confirm number 2 is an issue for me too.

I have found that if I use agk::SetClearColor() to the same colour as the sprite, even without clearing the screen, it fixes the issue for a while. But that stops working at some point but I have not yet figured out why it stops working. I think this partial workaround does not work for Blendman.

EDIT: After looking over my code, I do clear the screen so that's probably why it works for me, although it does stop working but that may be something I'm doing wrong. I hope having to clear the screen is not normal behaviour and this is fixable.

Ched80
13
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 24th Nov 2014 19:49
I don't think the help file for SetScreenResolution has been updated.

valtron
9
Years of Service
User Offline
Joined: 24th Nov 2014
Location:
Posted: 24th Nov 2014 21:00
Hi Paul,
Using agk2 steam version
When I build the agk player for ios, the player installs, I can load broadcasted games, but I get no sound on my Iphone

Similar when exporting a sample game like smack it, I can install the ipa on the phone but no sound

Running osx 10.1.1, xcode 6.1
Iphone ios 7.01

Regards
Val
Ched80
13
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 25th Nov 2014 08:11
Has anyone built an apk with v9 and got it running ok on a device?
My app now crashes on start up.

Ched80
13
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 25th Nov 2014 08:38
Ok My bad, I wasn't running the IDE from the steam folder. All is ok.

swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 27th Nov 2014 04:53
Found a bug. You can't return an object from a function and pass it directly into another as a reference. AppGameKit crashes/starts misbehaving.

I think the variable is deleted despite being passed in. Not quite sure. That's just my guess. There's quite a bit going on in my code so it's possible there's more to it.

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 27th Nov 2014 07:45
In V2, declaring variables like: test=10 in an include file, works fine, but test=0 generates an error.

If i use test as integer:test=0 then it's ok.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 27th Nov 2014 08:15
Would it be possible to add more settings to the IPA export?

e.g. Ganecentre on/off

Or do we need to compile with Xcode to switch the functionality?
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 27th Nov 2014 18:43
Quote: "In V2, declaring variables like: test=10 in an include file, works fine, but test=0 generates an error.

If i use test as integer:test=0 then it's ok."

What error do you get ? I've never had that happen

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 27th Nov 2014 19:21 Edited at: 27th Nov 2014 19:23
main.agc:9: error: "test" is being used without being defined or initialised



Main file:



function file:



----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 27th Nov 2014 23:17
Get used to stricter typing. Test could be anything from a banana to an alien spacecraft.

test as integer = 0

Oh - it's an integer. 7,000,000,000 potential errors eliminated.

-- Jim - When is there going to be a release?
Scary Little Rabbit
14
Years of Service
User Offline
Joined: 4th Aug 2009
Location: Chelyabinsk, Russian Federation.
Posted: 27th Nov 2014 23:58 Edited at: 28th Nov 2014 11:56
so I played again with it.

1) Paul, I see some strange behaviour around for-next loops. sometimes interpretator just skips it. I think it is bug.

I wasted about 4 hours to detect this in my project, but I did not find all mandatory conditions. for-next cycle was in function, stepping was alternated occasionally, all it's setting values was local and was not input values for that function (i.e. not as 'start' in example below).

please test the code:


first, usually, I have 3-4 'all right' statements in output message with a 'mad' one. then it comes as 1-2 'all right' and 1 'mad' for a while, then many times only 'mad' and then again 1-2-3 and 1 etc. and looks like it very rarely overflows index of for-next cycle, usually it skips the loop and my cycle counter stays as zero.

UPD
it goes crazy when value of stepping changes from negative (at previous call of function) to positive (at current stage) once and further it works right only whith negative stepping. 'crazy' means that when 'start' equals 'end' it goes to infinite loop and otherwise it completly skips the cycle.

2) a. new files added from IDE are encoding in UTF-8 (without BOM) and then at compilation stage ASCII 128-255 symbols are decoding wrong. (e.g. it converts cyrillic 'привет, мир!' to 'привет, РјРёСЂ!'. if you convert sources manually to ANSI Windows-1251 then the problem does not appear.)
b. new project template has CR-LF terminated lines but further when you paste some lines from anywhere IDE saves those pasted lines as LF terminated ones.

error #1:
"too many stars, too many stares. disembody."
WIP: MIND!! | free fonts for your AGKs
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Nov 2014 00:01
Impetus73, you should set the variable up as global if you want to use it globally. I think AppGameKit uses subroutines very similarly to functions in so far as variables declared in a subroutine are local to the subroutine, not where it was called from.

Change the sub:


Stricter typing can always help (not in this case) but I find using option explicit makes the basic language unnecessarily verbose. I prefer to declare global variable types but stick to '#' and '$' for implied local variables.
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 28th Nov 2014 05:11
Quote: " I think AppGameKit uses subroutines very similarly to functions in so far as variables declared in a subroutine are local to the subroutine, not where it was called from."

Really? I've always used subroutines when I've wanted to avoid making global variables Is this a new feature?

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 28th Nov 2014 07:24
Yes I agree with using stricter declaration, but I just pointed out that the interpreter makes an error, if you use include files and don't use strict.

In one of my projects, it complained about all the variables that I set to 0 initially, but not the ones that got a value above 0...

No needs for global. If I move the subroutine to the main file, there is no complaining. and since the include command is suppose to just attach the included file to the main, before interpreting it, this might indicate a serious fault in the interpreter.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 28th Nov 2014 09:35 Edited at: 28th Nov 2014 09:36
I just found out that the files saved and created with writeToFile(), SaveImage() etc. are saved in the Media folder of the AppGameKit player folder on Mac:

/Users/MyUsername/Library/Application\ Support/AGK\ Player/media/

This is a very awkward place to save app-centric files. The folder isn´t even searchable with spotlight as default since the agk player is inside a hidden system folder. I think this has to be changed.

Anyone know how to make agk save files to the apps own media folder on mac? I need it while this is fixed.

I never want what I know.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Nov 2014 09:43
Quote: "Really? I've always used subroutines when I've wanted to avoid making global variables Is this a new feature?"

No, I was wrong. I just added a declaration into the main.agc code above and it worked fine. I guess that declarations are carried into subroutines but not out of them.

It looks like it's possible to declare implicitly before a subroutine but not within it. I tried:

test as integer

and

test = 0

...before the subroutine was called and either worked.

I normally don't declare variables within a function or subroutine that I intend to use outside (implicitly or otherwise). It just seems wrong to me.

Login to post a reply

Server time is: 2024-05-06 22:15:43
Your offset time is: 2024-05-06 22:15:43