User Tag List

Page 27 of 43 FirstFirst ... 17 25 26 27 28 29 37 ... LastLast
Results 261 to 270 of 426

Thread: XLua extention beta

  1. #261
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    I believe the previous version would be 1.3 if you went chronologically, I've been updating each time you post one


    My guess is that it is something to do with the Backdrop Collision functions, since you changed them. I went through my scripts and changed all instances of the old "mmf.collisionmask.etc" to the new "mmf.collisions.testpoints" functions, and even played around to make sure it wasn't just looking at the wrong layer

    Is it possible that your newer implementation doesn't directly access the collision mask and thus can't seen "pasted into backdrop" objects like I am using? I've been using the "Create Backdrop" of the active picture object to construct levels at runtime


    I've confirmed that the issue is definitely with the "collisions" lines of code, which are returning "FALSE" no matter what I seem to put into them

  2. #262
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Pay attention to the following functions:

    mmf.ColllisionMask.TestPoint -> replaced by mmf.Collisions.BackdropTestPoint
    mmf.ColllisionMask.TestRect -> replaced by mmf.Collisions.BackdropTestRect
    mmf.ColllisionMask.TestSprite -> replaced by mmf.Collisions.BackdropTestObject

    mmf.Object.OverlapsBackground -> replaced by mmf.Collisions.BackdropTestObject
    mmf.Object.OverlapsObject -> replaced by mmf.Collisions.ObjectTestObject
    mmf.Object.OverlapsObjectClass -> replaced by mmf.Collisions.ObjectClassTestObject
    mmf.Object.GetOverlapList -> replaced by mmf.Collisions.GetObjectsOverObject

    The old names still exist but point to those new functions. The parameters (possibly even behavior) may be different.

    Also,

    mmf.Global.GetValue
    mmf.Global.SetValue
    mmf.Global.GetString
    mmf.Global.SetString

    have all switched from 1-based to 0-based indexing.

    Aside from that, not much changed between 1.3 and 1.4

  3. #263
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    If you can send me a failing example that would be great.

    It should still be testing the collision mask on layer 1. What changed is it should also start properly recognizing backgrounds on above layers as well.

  4. #264
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Hrmm no instances of global getter/setters, and I tried feeding into the layers parameter the mmf.ANY_LAYER keyword, but no cigar. I even tried flooring all of the parameters into the X/Y coordinates just in case it didn't like non-integers but that didn't do it either.

    Definitely something fishy between the two

  5. #265
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Well most of it is all undocumented voodoo so I guess an occasional regression is to be expected. But certainly, if you give me a small example I should be able to fix it.

  6. #266
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    heh, well I wish I had small examples
    I could throw you together one tomorrow when I get the time, or you could try your luck at digging through the horror chamber that is my project's code. Heres the malfunctioning file, I bolded sections where it stopped working:
    Code:
    numzones = 0;
    gravx = {};
    gravy = {};
    gravw = {};
    gravh = {};
    grava = {};
    distchecker = 12;
    
    function addZone(x,y,width,height,angle)
     numzones = numzones + 1;
     gravx[numzones] = x;
     gravy[numzones] = y;
     gravw[numzones] = width;
     gravh[numzones] = height;
     grava[numzones] = angle;
    end
    
    function resetZones()
     gravx = {};
     gravy = {};
     gravw = {};
     gravh = {};
     grava = {};
     numzones = 0;
    end
    
    function moveEnemy(id,velocity)
     objx = mmf.Object.GetX(id);
     objy = mmf.Object.GetY(id);
     angle = mmf.Object.GetValue(id,24);
     if mmf.Object.GetFlag(id, 27) then
      zone = -1;
     else
      zone = checkZones(objx,objy);
     end
     if zone > -1 then
      angle = zone + 90;
     end
     if mmf.Object.GetFlag(id,25) then
      truth = true;
     else
      testx = objx + math.cos(math.rad(angle-90)) * 8;
      testy = objy - math.sin(math.rad(angle-90)) * 8;
      truth = mmf.Collisions.BackdropTestPoint(testx,testy,2);
     end
     if truth then
      angle = getEnemyAngle(id,angle,velocity,objx,objy);
      objx = objx + math.cos(math.rad(angle)) * velocity;
      objy = objy - math.sin(math.rad(angle)) * velocity;
      mmf.Object.SetX(id,objx);
      mmf.Object.SetY(id,objy);
      angle = angle + (29 / velocity);   
      if mmf.Object.GetFlag(id,26) then                       --disable it with flag 26
       --Nothing!
      else
       angle = correctAngle(objx,objy,angle);                    --this is the fixer code. Might be bad?
      end
      if zone > -1 then
       angle = zone + 90;
      end
      mmf.Object.SetValue(id,24,angle);
     else
      for i=0,128 do
       testx = objx + math.cos(math.rad(angle-90)) * i;
       testy = objy - math.sin(math.rad(angle-90)) * i;
       if mmf.Collisions.BackdropTestPoint(testx,testy,2) then
        j = i - 1;
        testx = objx + math.cos(math.rad(angle-90)) * j;
        testy = objy - math.sin(math.rad(angle-90)) * j;
        mmf.Object.SetX(id,testx);
        mmf.Object.SetY(id,testy);
        return;
       end
      end
      angle = angle + 45;                                     --if no solid ground is found, rotate!
      mmf.Object.SetValue(id,24,angle);
      return;
     end
    end
    
    function getEnemyAngle(id,inputangle,inputvelocity,objx,objy)
     pusher = 0;
     angle = inputangle;
     basex = objx;
     basey = objy;
     velocity = inputvelocity;
     if velocity == 0 then
      return angle;
     end
     if velocity > 0 then
      if velocity < 1 then
       velocity = 1;
      end
      mmf.Object.SetFlag(id,4,true);
      pusher = 3;
     end
     if velocity < 0 then
      if velocity > -1 then
       velocity = -1;
      end
      pusher = -3;
      mmf.Object.SetFlag(id,4,false);
     end
     newx = basex + math.cos(math.rad(angle)) * velocity; 
     newy = basey - math.sin(math.rad(angle)) * velocity;
     if mmf.Collisions.BackdropTestPoint(newx,newy,2) then
      for i=0,45 do
       angle = angle + pusher;
       newx = basex + math.cos(math.rad(angle)) * velocity; 
       newy = basey - math.sin(math.rad(angle)) * velocity;
       if mmf.Collisions.BackdropTestPoint(newx,newy,2) then
        --nothing!
       else
        mmf.Object.SetFlag(id,25,true);
        return angle;
       end
      end
      mmf.Object.SetFlag(id,25,false);
     else
      for i=0,45 do
       angle = angle - pusher;
       newx = basex + math.cos(math.rad(angle)) * velocity; 
       newy = basey - math.sin(math.rad(angle)) * velocity;
       if mmf.Collisions.BackdropTestPoint(newx,newy,2) then
        mmf.Object.SetFlag(id,25,true);
        return angle + pusher;
       end
      end
      mmf.Object.SetFlag(id,25,false);
     end
     return angle;
    end
    
    function checkZones(x,y)
     for i=1,numzones do
      if x > gravx[i] then
       if x < gravx[i] + gravw[i] then
        if y > gravy[i] then
         if y < gravy[i] + gravh[i] then
          return grava[i];
         end
        end
       end
      end
     end
     return -1;
    end
    
    function correctAngle(x,y,angle)
     angleless = angle + 90;
     anglemore = angle + 90;
     dist = distchecker;
     angleless = leftAngle(x,y,angleless,dist);
     anglemore = rightAngle(x,y,anglemore,dist);
     xl =  x + math.cos(math.rad(angleless)) * dist;
     yl =  y - math.sin(math.rad(angleless)) * dist;
     xr =  x + math.cos(math.rad(anglemore)) * dist;
     yr =  y - math.sin(math.rad(anglemore)) * dist;
     dx = xr - xl;
     dy = yr - yl;
     res = 180 - math.deg(math.atan2(dy,dx));
     return res;
    end
    
    function leftAngle(x,y,angle,dist)
     tangle = angle;
     for i=0,45 do
      testX = x + math.cos(math.rad(tangle)) * dist;
      testY = y - math.sin(math.rad(tangle)) * dist;
      truth = checkPoint(testX,testY);
      if truth then
       return tangle;
      else
       tangle = tangle - 4;
      end
     end
     return tangle;
    end
    
    function rightAngle(x,y,angle,dist)
     tangle = angle;
     for i=0,45 do
      testX = x + math.cos(math.rad(tangle)) * dist;
      testY = y - math.sin(math.rad(tangle)) * dist;
      truth = checkPoint(testX,testY);
      if truth then
       return tangle;
      else
       tangle = tangle + 4;
      end
     end
     return tangle;
    end
    
    function checkPoint(x,y)
     if mmf.Collisions.BackdropTestPoint(x,y,2) then
      return true;
     else
      return false;
     end
    end
    if you really want to take a look at the code to see if you can divine any differences I can shoot you a PM


    edit: nvm about the bolded parts -.- Can't keep the formatting and still bold the code I guess

  7. #267
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    Heh, not a big fag of white space are you? :P

    I just did a bunch of testing with add backdrop / paste backdrop of active objects. I didn't encounter any problems on either layer 1 or layer 2.

    If in doubt, try removing the layer parameter entirely. Remember that the layer refers to what layer the backdrop was on / created on.

  8. #268
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    No luck removing that parameter either :S

    Looks like its definitely some issue with the actual mechanics of how its checking the collision mask, but how many million different things could go wrong with that?

  9. #269
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    You're sure your coordinates are correct? :/

    Would you PM me your xlua.mfx so I can be sure you don't have some obscure broken version of it?

  10. #270
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: XLua extention beta

    sure thing, and I'll try copying over it after that just to make sure. I tried switching it to a TestBackdropObject instead of TestBackdropPoint, and the game would completely crash every time it came across that line of code

    no luck with TestRect, either

Page 27 of 43 FirstFirst ... 17 25 26 27 28 29 37 ... LastLast

Similar Threads

  1. XLua
    By Retriever2 in forum Released Extensions
    Replies: 6
    Last Post: 13th August 2017, 07:42 PM
  2. Extention error with exe
    By Jinxtengu in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 15th October 2012, 03:47 AM
  3. SPC extention question
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 20th November 2009, 03:25 PM
  4. Lua+ or xLua?
    By Shawn in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 17th October 2009, 10:55 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
  •