Results 1 to 22 of 22

Thread: auto colage

  1. #1
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default auto colage

    i need to make a colage(a bunch of pics pasted on a poster.) for class and i decided to do it with scar. heres my code that doesnt work :/

    Code:
    program New;
    
    var i:integer;pic,npic: array of integer;
    procedure Declareanddraw; 
    begin
    wait(1000)             //so i can pause and go through line by line before error
      for i := 0 to 9 do
        pic[i] := Loadbitmap('C:\bit\images_00'+inttostr(i)+'.bmp');    //load bmps into array
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);       //The higher i is the forther the pic will be drawn
                                                                                                        //instead of drawing them on top of each other 
                                                         ||
    for i := 10 to 19 do                //        \/------- since the filename has a three digit number i had to remove a 0
        pic[i] := Loadbitmap('C:\bit\images_0'+inttostr(i)+'.bmp');
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);
    end;
    
    begin
    declare
    end.
    and i get this error:

    Code:
    Successfully compiled (57 ms)
    [Runtime Error] : Out Of Range in line 8 in script
    Last edited by g0tp0t; 03-19-2010 at 02:37 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Got to turn this in today, any ideas? please post

  3. #3
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    You have to set the length of your array before using it.

  4. #4
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Remember to free your bitmaps aswell.
    lol

  5. #5
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    And load the target bitmaps

  6. #6
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    k, I'm doing that now

  7. #7
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    SetLength(pics, 20); // at the beginning
    for i := 0 to 19 do // at the end
      FreeBitmap(pics[i]);
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  8. #8
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now I have this:
    Code:
    program New;
    
    var i:integer;pic,npic: array of integer;
    procedure Declareanddraw; 
    begin
    wait(1000)             //so i can pause and go through line by line before error
      for i := 0 to 9 do
        pic[i] := Loadbitmap('C:\bit\images_00'+inttostr(i)+'.bmp');    //load bmps into array
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);       //The higher i is the forther the pic will be drawn
                                                                                                        //instead of drawing them on top of each other 
                                                         ||
    for i := 10 to 19 do                //        \/------- since the filename has a three digit number i had to remove a 0
        pic[i] := Loadbitmap('C:\bit\images_0'+inttostr(i)+'.bmp');
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);
    end;
    
    begin
    declare
    end.
    Which gives me this:

    Code:
    Line 4: [Error] (4:4): colon (':') expected in script
    EDIT: i added navas suggestion and still same exact error

  9. #9
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    SCAR Code:
    program New;
    var
      i:integer;
      pic,npic: array of integer;

    procedure Declareanddraw;
    begin
      for i := 0 to 9 do
      begin
        pic[i] := Loadbitmap('C:\bit\images_00'+inttostr(i)+'.bmp');
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);
      end;
      for i := 10 to 19 do
      begin
        pic[i] := Loadbitmap('C:\bit\images_0'+inttostr(i)+'.bmp');
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);
      end;
    end;

    begin
      declareanddraw;
    end.

  10. #10
    Join Date
    Feb 2010
    Location
    On the edge of space
    Posts
    160
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just get a flippin poster and paste. You said that it to be done on a poster.

  11. #11
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Diddy Kong View Post
    Just get a flippin poster and paste. You said that it to be done on a poster.
    It doesn't matter about that, he asked for scar help, if you don't know how to help him, please don't post.

  12. #12
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    When i said a bunch of pictures 'pasted to a poster' i was trying to give an idea of what i was trying to do.

    i am trying Your code now, Ill edit in a sec

    ------

    Myles, your code gives me this...


    Successfully compiled (43 ms)
    [Runtime Error] : Out Of Range in line 10 in script
    Last edited by g0tp0t; 03-25-2010 at 12:28 AM.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  13. #13
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    SCAR Code:
    program New;
    var
      i:integer;
      pic,npic: array of integer;

    procedure Declareanddraw;
    begin
      SetArrayLength(pic, 20);
      for i := 0 to 19 do
      begin
        pic[i] := Loadbitmap('C:\bit\images_0'+Replicate('0', 2-length(inttostr(i)))+inttostr(i)+'.bmp');
        FastDrawTransparent(random(150)*i,random(150)*i,pic[i],npic[i]);
      end;
    end;

    begin
      declareanddraw;
    end.

  14. #14
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program SlideShow;

    var
      i, lx, ly, tx, ty: Integer;
      pic: array of Integer;

    procedure Declareanddraw;
    begin
      SetLength(pic, 20);
      for i := 0 to 9 do
      begin
        pic[i] := Loadbitmap('C:\bit\images_00'+inttostr(i)+'.bmp');
        GetBitmapSize(pic[i], tx, ty);
        if (tx > lx) then
          lx := tx;
        if (ty > ly) then
          ly := ty;
        SafeDrawBitmap(pic[i], GetDebugCanvas, random(150),random(150));
        Wait(1000 + Random(500));
      end;
      for i := 10 to 19 do
      begin
        pic[i] := Loadbitmap('C:\bit\images_0'+inttostr(i)+'.bmp');
        SafeDrawBitmap(pic[i], GetDebugCanvas, random(150),random(150));
        Wait(1000 + Random(500));
      end;
      for i := 0 to High(pic) do
        try
          FreeBitmap(pic[i]);
        except
        end;
    end;

    begin
      DisplayDebugImgWindow(600, 600);
      declareanddraw;
      Writeln('Please change line 36 into: ' + Chr(13) +
      'DisplayDebugImgWindow(' + IntToStr(lx + 150) + ', ' + IntToStr(ly + 150) + ');');
    end.

    try that

  15. #15
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Timers program works!!!!!! kinda

    it ran and the pictures were extremely spaced, and only the first 4 pics showed the first time i ran.

    The second time it was perfect. How would it resize the pics randomly... is that even possible with scar?? and a random angle between -15 and 15 degrees would make it look more natural. neither of those i know how to do in the debug window.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  16. #16
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Those are both possible. the resizing would just be getting the dimensions and multiplying that by a decimal, I think. And rotating would just be a for loop along with RotatePoint.

    I think.

  17. #17
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    program SlideShow;

    var
      
    inlxlytxtyInteger;
      
    pic: array of Integer;

    procedure Declareanddraw;
    begin
      SetLength
    (pic20);
      for 
    := 2 to 9 do
      
    begin
        pic
    [i] := Loadbitmap('C:\bit\images_00'+inttostr(i)+'.bmp');
        
    GetBitmapSize(pic[i], txty);
        if (
    tx lxthen
          lx 
    := tx;
        if (
    ty lythen
          ly 
    := ty;
        
    SafeDrawBitmap(pic[i], GetDebugCanvasrandom(150)*(random(9)+1),random(150)*(random(9)+1));
        
    Wait(10 Random(20));
      
    end;
      for 
    := 10 to 18 do
      
    begin
        pic
    [i] := Loadbitmap('C:\bit\images_0'+inttostr(i)+'.bmp');
        
    SafeDrawBitmap(pic[i], GetDebugCanvasrandom(150)*(random(9)+1),random(150)*(random(9)+1));
        
    Wait(10 Random(20));
      
    end;
      for 
    := 0 to High(pic) do
        try
          
    FreeBitmap(pic[i]);
         
    except
        end
    ;
    end;

    begin
      DisplayDebugImgWindow
    (600600);
      for 
    := 1 to 50 do
       
    begin
        declareanddraw
    ;
        
    ClearReport;
        
    AddToReport(inttostr(n));
      
    end;

      
    Writeln('Please change line 36 into: ' Chr(13) +      //whats this for? lol
      
    'DisplayDebugImgWindow(' IntToStr(lx 150) + ', ' IntToStr(ly 150) + ');');
    //how do I copy and save the debug image??
    end
    i sped it up and made it repeat 50 times to eliminate black spots... all i need now is to save it to bmp.

    Timer owns!!
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  18. #18
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    need any more help with it?

  19. #19
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    Those are both possible. the resizing would just be getting the dimensions and multiplying that by a decimal, I think. And rotating would just be a for loop along with RotatePoint.

    I think.
    rotate point? is that srl or scar?

    and if i multiply the dimensions by a random value, then instead of resizing... wouldnt that just trim the pic? i was thinking something like a for loop inside a for loop to copy certain pixels into another bmp, Which would scale the pic... but i dont know how to retrieve a single point either :P


    ===========

    need any more help with it?
    lol, the last semi-important piece is saving to bmp from debug. if it isn't possible i can just use print-screen button on keyboard and print it that way. But that's kinda like cheating :P

    i also want help with resizing and rotating the pics randomly to make it look less perfect, but this last little part is optional, to make it i little higher quality, ill post the result in a min.



    ill edit the edges of the pics in photoshop to make them look faded/torn too. i don't need help with that though
    Last edited by g0tp0t; 03-25-2010 at 03:18 AM.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  20. #20
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    can i get access to your images?

    edit:
    add this before end.
    SCAR Code:
    SaveBitmap(GetDebugCanvas, 'C:\bit\thecollage.bmp');
    so it looks like,
    SCAR Code:
    ...stuff
      SaveBitmap(GetDebugCanvas, 'C:\bit\thecollage.bmp');
    end.

  21. #21
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    RotatePoint is in the WizzyPlugin, I think. I didn't really expect you to know what to do with it, more so just giving ideas to anyone who would help.

  22. #22
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    LOL, just telling me where i might find it is a big help, maybe i can figure out how to use it, lol.


    Yes, i will attach them all, but they were all off the first page in Google images so there isn't a ton, lol, I'm getting more after i take a shower. lol

    g0tp0t4u2share.t35.com

    ftp pass is hitthebong

    Sorry for not just linking to it lol im too lazy right now to get each link but the 7zip file is g0tp0t4u2share.t35.com/bit.7z and all images are in the same directory as the 7zip file i just linked, named 001-018 like in script

    Back

    =========

    May 26:

    i have to work on this same thing for school again, :\. lol. so not a gravedig because the posts above this are usefull :P.

    i like it and am trying to create a tpointarray from text or somehow draw text on the bottom of each image which is generated. i also want to make the pictures not cover other images as much. im failing so far :'{


    Just realized that happened to be a double post. ill post the code i have edited :]
    Last edited by g0tp0t; 05-26-2010 at 02:09 PM.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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