Author Topic: attempted to access ... on inactive sprite  (Read 7126 times)

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
attempted to access ... on inactive sprite
« on: 2008-08-22, 02:26:49 PM »
hi there,
my player drops seed when a button is pressed. if the seed touches the ground, it can be collected again. that works wonderful all the time, as long no one drops more than one seed in one spot. than this message comes  "attempted to access PixelX on inactive sprite". the seed sprite has some rules, they are very simple. after be touched the sprite is deactivated. so i don
« Last Edit: 2008-08-22, 02:34:45 PM by Tanja »

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: attempted to access ... on inactive sprite
« Reply #1 on: 2008-08-23, 08:23:00 PM »
I can't guess why you would have an inactive sprite problem only when there are two in the same place.  I guess I would need to see more of the code, or know more about where the error occurred.  If you have C# installed, maybe you could run it in a debugger to find out more detail about where the error happened.  If you run the project in debug mode from SGDK2, does it tell you more about the code where the error occurred?

IsKeyPressed doesn't support "InitialOnly"; only the controller inputs can return information about whether this is the first press because they are the only buttons that are tracked.  In order to determine if some random key was pressed before, all keys on the keyboard would have to be tracked.  But they are not being tracked.  The intention is that games only deal with controller inputs, so they are supported better than arbitrary keypresses.

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: attempted to access ... on inactive sprite
« Reply #2 on: 2008-08-24, 02:22:06 AM »
couldn't you just stop two being in the same place, if one seed touches other seed, delete the seed and give it back to the players inventory.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: attempted to access ... on inactive sprite
« Reply #3 on: 2008-08-24, 12:36:40 PM »
the game was running now for two days at the games convention in Leipzig. i wasn

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: attempted to access ... on inactive sprite
« Reply #4 on: 2008-08-25, 05:11:48 AM »
I doubt that it's a hardware/environment difference.  That error is pretty specific to SGDK2 code.  It's probably just a specific use that didn't get hit in those 2 days.

(Has the game been posted for public download anywhere yet?)

Weird coincidence: Looks like Jam0864 and Tanja reached 500 posts at the same time!

(Edit - 2 spelling corrections)
« Last Edit: 2008-08-25, 07:01:01 AM by bluemonkmn »

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: attempted to access ... on inactive sprite
« Reply #5 on: 2008-08-25, 05:53:26 AM »
wow that is weird LOL

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: attempted to access ... on inactive sprite
« Reply #6 on: 2008-08-25, 06:12:07 AM »
hehe, funny coincidence.  8) yay 500!
i want to provide the game in the next few days. but it is far from being finished, in my opininion. but a lot of kids liked it much anyways.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: attempted to access ... on inactive sprite
« Reply #7 on: 2008-08-25, 07:46:49 AM »
I imagine BlueMonk is asking because if it were available, he could take a look and see where the problem might lie, whether it's a bug in SGDK2 or just an overlooked use-case in the programming that wasn't taken care of.
Edward Dassmesser

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: attempted to access ... on inactive sprite
« Reply #8 on: 2008-08-25, 08:31:24 AM »
i know, i just want to fix a few thing before i give it away.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: attempted to access ... on inactive sprite
« Reply #9 on: 2008-08-26, 10:59:31 AM »
IsKeyPressed doesn't support "InitialOnly"; only the controller inputs can return information about whether this is the first press because they are the only buttons that are tracked.  In order to determine if some random key was pressed before, all keys on the keyboard would have to be tracked.  But they are not being tracked.  The intention is that games only deal with controller inputs, so they are supported better than arbitrary keypresses.

okay, wouldn

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: attempted to access ... on inactive sprite
« Reply #10 on: 2008-08-26, 08:17:28 PM »
My first suggestion to you is to use the inputs instead, just map the particular key you're using to the default value for a button in the controls you aren't using (Look in Controls.cs).  That is the suggested way of getting input from the player, since the player can then customize the controls.

However, if you have only one place that this key is used, and it's a special case, or you just don't have any inputs left in the controls, or you have some other reason you want to use IsKeyPressed, you can make up your own "InitialOnly" manually.

I'm assuming these rules are being executed on a sprite.  First, create a property on the sprite called wasPressed.  Then create this control structure using the rules:
Code: [Select]
if IsKeyPressed(your key)
  if wasPressed == 0
    (Do whatever you want to do)
  end if
  wasPressed = 1
else
  wasPressed = 0
end if
Edward Dassmesser

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: attempted to access ... on inactive sprite
« Reply #11 on: 2008-08-27, 07:52:19 AM »
thanks, that must work! i love the sprite parameters, first i tried to do all with counters, that was confusing.

@bluemonk: take a look at my last post here, there is supposed to be more text. i hope this happens not everywhere. why are we moving?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: attempted to access ... on inactive sprite
« Reply #12 on: 2008-08-27, 11:06:52 AM »
Looks like the SMF backup procedure didn't escape German single-quotes (???).  That's really odd.  My single quotes are OK, but yours aren't.  Your client must have been submitting apostrophes with a different code somehow.  That sounds like a serious potential security breach in SMF.

We're moving so that I have the forums on a server I control and Pr0c doesn't have to maintain a running database (server) just for my forum.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: attempted to access ... on inactive sprite
« Reply #13 on: 2008-08-27, 11:53:15 AM »
i used an accent instead of an real apostroph, i think. like in

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: attempted to access ... on inactive sprite
« Reply #14 on: 2008-08-28, 04:43:45 PM »
Woohoo -- fixed it.  :nerd:
(I don't know what happened here though.  Did that one ever look any better?)