User Tag List

Results 1 to 6 of 6

Thread: Bug With "Restrict actions"

  1. #1
    No Products Registered

    Join Date
    Jul 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Bug With "Restrict actions"

    Is it just me, or is the Restrict actions condition broken if you use an expression for the amount of time?

    I've gone so far as making a new project with nothing on it but a counter, and having a single event:
    * Restrict actions for 00"-50
    Add 1 to Counter

    This works fine, adding 2 to the counter every second. However, if I edit this event, click Use a calculation, then enter 500 (out of 1000, although these values are just exemplary; any number entered after Use a calculation is clicked has the same result), then the counter will only increase to 1 and never go up again.

    I need to have an event happen less than 50 times a second, depending on the player's current speed (otherwise the slowest I can move an object is 50 pixels per second, which is too fast for what I want). Restrict actions seems like the logical way to do this, but it doesn't seem to be working for any kind of expression. I don't think I'm using it wrong, since it works when I don't use a calculation, but that won't help me. So I'm wondering, does this bug happen for anyone else? And if so, is there an alternate way of restricting actions that isn't too complex?

  2. #2
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Bug With "Restrict actions"

    why dont you create a counter that is used to determine fps and use that for your events.
    something like this:

    * Always
    -> Add 1 to counter 'timer'

    * If counter 'timer' = x
    -> Set counter 'timer' to 0
    -> Do what i want here

    That way the always event will be triggered every frame and it will be based on your games FPS rather than timers which can sometimes mess up your game.

  3. #3
    No Products Registered

    Join Date
    Jul 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Bug With "Restrict actions"

    Ah, that sounds like it would work... although wouldn't that need a separate counter for each event that triggers in that fashion? Seems like it could result in a performance hit if I needed too many of 'em...

    Or maybe I've just become performance-paranoid thanks to classes. It's been a while since I've used MMF for much but I find myself trying to figure out what each organization of events would relate to in C code, then organize them in the optimal way there.

    Speaking of optimizations -- this question seems so minor that I don't want to make a new thread for it, but is there any easy way to get the sign of a variable? Right now I'm saying:
    variable / Abs(variable)
    just to get a +1/-1 value, but I'm doing it a few dozen times per frame and that can't be too efficient.

    (Also, can anyone confirm that Restrict actions does/doesn't work when using calculations? If it doesn't, I'd like to report it as a bug, just for posterity.)

  4. #4
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Bug With "Restrict actions"

    Well the counter can maybe be used as a global counter by which all actions use it. It increases in value every frame, an you can divide it by a certain number and if the remainder is 0, then its time to trigger then event. I am fairly sure the 'mod' function is used to determine this (i could be wrong).

    For example, the counter is at 1200 and you want an event to trigger every 20 frames, you could do

    * counter 'timer' mod 20 = 0
    -> trigger event

    I think thats how you can do it. Im not in front of MMF2 now so can't do any testing.

  5. #5
    No Products Registered

    Join Date
    Jul 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Bug With "Restrict actions"

    Ah, brilliant! I really should've thought of that considering I've had more than one course dealing heavily in modular arithmetic, but I think I have lost touch with MMF over the years so I suppose I don't always think about it clearly.

    What you described should work perfectly, and to prevent any overflow issues, the counter can be reset to 0 every few blocks of 50 frames (as long as you're not modding by something larger than the reset interval). Then I won't have to worry about negligible performance hits or feel bad that I'm using a workaround since that method will work correctly regardless of the lag factor, which is something Restrict actions doesn't. And thanks for the quick replies -- I wasn't expecting anything tonight, but now I've got something to do on the commute home.

    So, problem solved (as far as I'm concerned). But if anyone else can verify that Restrict actions is buggy, it'd be a kindness if it were reported. Thanks!

  6. #6
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Bug With "Restrict actions"

    No problem. The method mentioned above is also good for slow computers or lag because it doesnt work with a timer so the events should always be triggered when they need to. This is especially important for multiplayer games!

    When I get home I will see if I can find the same bug with restrict actions. Although knowing me I will forget all about it :P

Similar Threads

  1. "Cannot load joystick2.mfx" when "Compress the runtime" unchecked. Fine when checked.
    By DistantJ in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 14th September 2013, 09:44 PM
  2. "Bug" For Saving and Loading Frame Positions AND "Timer Glitch"?
    By Zarpo in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th March 2012, 12:40 PM
  3. "Restrict Actions" CONFIRMED BUG
    By Eliyahu in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 13th September 2009, 05:22 AM
  4. "Restrict actions" is BROKEN!
    By Pkeod in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 26th August 2008, 12:41 PM
  5. Actions sur les objets "decors"
    By mig3 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 29th January 2008, 04:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •