Pages: 1
  Print  
Author Topic: bug with data structures?  (Read 8689 times)
Offline (Unknown gender) impo
Posted on: February 13, 2019, 11:36:21 am
Member
Joined: Feb 2019
Posts: 15

View Profile
create an object and add to Draw Event:
Code: [Select]
if (ds_list_exists(any_variable_here))
draw_text(200,200,"mylist exists")

put object on the room and try to run it. no text should be displayed

now create another object or use this one (doesn't really matter), and put this code on Create Event:
Code: [Select]
any_list_name=ds_list_create()
try to run the game again. in my case ds_list_exists returns 1 with any existing ds list in the room, regardless of whether this is the ds list I checked for existence or not. 

is this program behavior common to everyone, or is it just me? and if its common, did i use the function wrong, or is there actually a bug?
« Last Edit: February 13, 2019, 11:41:59 am by impo » Logged
Offline (Unknown gender) impo
Reply #1 Posted on: February 13, 2019, 12:30:38 pm
Member
Joined: Feb 2019
Posts: 15

View Profile
the problem is that if the list actually exists, this function successfully checks its existence. but if there is no such list, the function can't find what to check, and instead of returning zero, checks existence of the first created list in the room (or zero, if there are no lists at all)
Logged
Offline (Male) Goombert
Reply #2 Posted on: February 13, 2019, 01:57:24 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
GM8 does the same, it's because you have the game setting "Treat uninitialized variables as 0" enabled.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print