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.

DarkBASIC Professional Discussion / subscript must be integer or DWORD when refferencing array error

Author
Message
Penfold
22
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 24th May 2011 12:45
I get this error when trying to apply data to my array using the following line of code

player(myplayerNum).angle = object angle y(myplayerNum)

the array is made and set to global so I know this isnt an issue.

the angle is refferenced as a float in my variables so Im not sure why its not letting me add the data to it. Unless I maybe need to truncate it down because there are too many digits after the decimal point?

Thanks in advance.

'Ooh 'eck chief'...'crumbs'
Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 24th May 2011 13:00
What datatype is myplayerNum? If the error your receiving is what you've put in the title, it sounds like the problem is that it's not an integer or a dword. The problem shouldn't be the datatype of the angle.

Does this work?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th May 2011 15:03
Check this:


Your myplayerNum is not an integer or dword value.

Penfold
22
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 24th May 2011 20:59
thanks Lucas this worked. Not sure why I have to trick it into doing that I would have thought my way would have worked but until I either read why or someone can give me a laymans explanation why my version didnt work and yours did this will have to do,

Thanks Again

'Ooh 'eck chief'...'crumbs'
Penfold
22
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 24th May 2011 21:03
oh yes to answer the question myplayerNum is defined as an integer and this particular code is grabbing the player number designated by the connection code to alter the stored variables so that it can *push* it back to the server after movement is completed

'Ooh 'eck chief'...'crumbs'
Scraggle
Moderator
23
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 24th May 2011 22:03
Quote: "until I either read why or someone can give me a laymans explanation why my version didnt work"

That's what IanM just did.
Your myplayerNum variable is not an integer or dword.

Penfold
22
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: RED postbox houses of parliment
Posted: 24th May 2011 23:43
sorry scraggle in laymans ie simple terms with a bit of explanation. its saying myplayerNum was not an integer or a dword..

as far as I was aware myplayerNum was an integer as it couldnt have been anything else *designated player number by the server* and I dont know what the dword actually is...

'Ooh 'eck chief'...'crumbs'
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th May 2011 23:53
Quote: "as far as I was aware myplayerNum was an integer as it couldnt have been anything else "


Why not? Where else have you used or declared that variable?

Example:

Login to post a reply

Server time is: 2026-07-10 19:47:28
Your offset time is: 2026-07-10 19:47:28