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 / What is wrong with this array,printing enemys name

Author
Message
Daniel wright 2311
User Banned
Posted: 17th Oct 2011 06:21
So I want to print out each enemies name when the player collides with them,so I created a array and all it prints is o.here is my code Thanks guys.



my signature keeps being erased by a mod So this is my new signature.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 17th Oct 2011 06:28
You've declared the array as an integer array, and you're populating it with integers called John, Bob, etc, all which have the default value of zero.

Change the array to be a string array, and give them values in quotes, such as "John" and "Bob", etc.

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 17th Oct 2011 06:33 Edited at: 17th Oct 2011 06:34
The name field in this declaration is defaults to be Integer

Quote: "
type enemies
ehealth
estates
animestate2#
emovespeed
edied
eposition
name
endtype
"


So it needs to be defined as a string, so either add $ the post fix or "as string" to it

Quote: "
type enemies
ehealth
estates
animestate2#
emovespeed
edied
eposition
name$
endtype
"




Quote: "
type enemies
ehealth
estates
animestate2#
emovespeed
edied
eposition
name as string
endtype
"


Login to post a reply

Server time is: 2026-07-10 06:36:20
Your offset time is: 2026-07-10 06:36:20