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 / [SOLVED] AGK 2.0.19 - ArrayLenth and Orthographic issues

Author
Message
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 15th Jun 2016 23:53 Edited at: 18th Jun 2016 21:51
Two separate issues:

Array length errors. This worked before 2.0.19.
Throws error: "Array index out of bounds, Index: 25, Array Length: 24..."

EDIT: Just tried adding "0," to the beginning of the list. I'm guessing Index:0 is now used?


Orthographic mode [ SetCameraFOV(1,0) ] seems to have some culling issues:

The author of this post has marked a post as an answer.

Go to answer

Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 16th Jun 2016 00:09


fills the array from 0 to 24 => 25 entries
0 = 1 ; 1 = 2 ; 2 = 3 .....

so you have to use:



Quote: "Orthographic mode [ SetCameraFOV(1,0) ] seems to have some culling issues"

I can't confirm it, because I don't use it right now, can you please build a snippet for Paul with the culling error?
If the culling is urgent for you, you can disable the object culling and write a custom routine, this should work until the bug is fixed.

[/url]
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 16th Jun 2016 00:52 Edited at: 16th Jun 2016 00:53
Yes, it seem arrays were changed to start at 0 instead of 1.

Was not aware it was possible to disable culling, thanks!
SetObjectScreenCulling( objID, mode )
Just found the command, problem fixed. ( or problem avoided )
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 16th Jun 2016 01:07
You're welcome, mate

[/url]
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Jun 2016 02:52
This post has been marked by the post author as the answer.
Quote: "DIM TableMap[25] = [
5,2,1,3,5,
5,4,3,3,1,
3,3,1,1,4,
3,2,5,1,2,
5,2,4,2,3]"

Assigning an array some literal values now resizes the array to match the number of values, the indexing is the same as before. So previously your array would be length 25 with your values stored in indices 0 to 24, with the value 0 being stored in index 25. Now it only has your values in indices 0 to 24. You can change the length back to 25 after the assignment with TableMap.length=25 if you want to replicate the previous behaviour.

Quote: "Orthographic mode [ SetCameraFOV(1,0) ] seems to have some culling issues"

Thanks, fixed for the next version.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 16th Jun 2016 09:53
I've always used array element 0??
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Jun 2016 10:35
Yes, element 0 was always there. But I recall there was a small glitch when you pre-populated it with the wrong number of values and it was fixed quite recently.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 16th Jun 2016 11:27
Ah, I never pre-populated the values.
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 17th Jun 2016 19:58 Edited at: 17th Jun 2016 20:18
I have the similar issue with the array error

if i go over 20 it comes up with the error

I'm using the type action to do what i need


Attached is my example

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Jun 2016 20:25
Quote: "Attached is my example"


oh no it's not!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 17th Jun 2016 20:31 Edited at: 17th Jun 2016 20:34
The System is taking it's time ;op

I miss the old setup .. it could keep up
this one is slow

just a couple of clicks then every thing is done
this one seems to need more hints
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 17th Jun 2016 20:39
reload web page it's there now
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Jun 2016 07:54
The problem isn't your array, it is your loop calculation. you are trying to add element 26 to an array of length 25.
Here is the log for xxz, your element variable:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 19th Jun 2016 18:15
@BatVink

umm but i thought i had the program make enough space for any array

so if i want 25 locations it should do that
if i want 40 location it should do that

so what part of my code is wrong ?
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 19th Jun 2016 18:21
@BatVink

Original line:
Xv=4:Yv=5:Zv=Xv*Yv

New Line
Xv=5:Yv=5:Zv=Xv*Yv+5

in the first line it crashes
if do the second line it dose not give me that error and everything shows up

how come if all i need is 25 places it have to give it 30 places to store data ?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Jun 2016 06:30
This is a very good read as far as arrays and version 2+ is concerned
https://www.appgamekit.com/documentation/guides/12_array_changes.htm
The main thing you need to know is that DIM automatically makes the variable global where are MyArray as integer[] needs the "global" tag to make it global.
Note the MyArray.insert() function. Very handy for adding stuff onto the end of arrays.
MyArray.remove() is vary handy from removing stuff too.
MyArray.sort() also sorts the array
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Jun 2016 11:04
I didn't work out your calculation, I just observed that you tried to update element 26. But you only had 25 elements in the array.
It's this code, not a bug with arrays...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 21st Jun 2016 20:36
@BatVink

i fixed up all my mistakes and even despite that i have a limit of 7 x 7 for buttons spots to be put on the screen

it seems if i go past that number it can't seem to do the math the way i want it to be
but for what i needed it to do things are where I need them

attached is updated version

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-09-29 15:25:41
Your offset time is: 2024-09-29 15:25:41