Results 1 to 19 of 19

Thread: Forms - Editing for progress reports

  1. #1
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default Forms - Editing for progress reports

    I'm testing something out right now, on how to make a while-running progress report.

    I got most of it set up right I think, but I can't seem to be able to edit the labels.

    SCAR Code:
    program New;

    var
    frmDesign : TForm;
    Label1 : TLabel;
    Label2 : TLabel;
    v: TVariantArray;

     procedure InitForm;
      begin
       frmDesign := CreateForm;
       frmDesign.Left := 255;
       frmDesign.Top := 137;
       frmDesign.Width := 214;
       frmDesign.Height := 89;
       frmDesign.Caption := 'Progress Report';
       frmDesign.Color := clBtnFace;
       frmDesign.Font.Color := clWindowText;
       frmDesign.Font.Height := -11;
       frmDesign.Font.Name := 'MS Sans Serif';
       frmDesign.Font.Style := [];
       frmDesign.Visible := False;
       frmDesign.PixelsPerInch := 96;
       Label1 := TLabel.Create(frmDesign);
       Label1.Parent := frmDesign;
       Label1.Left := 25;
       Label1.Top := 15;
       Label1.Width := 100;
       Label1.Height := 20;
       Label1.Caption := 'Loads Mined:';
       Label1.Font.Color := clWindowText;
       Label1.Font.Height := -16;
       Label1.Font.Name := 'MS Sans Serif';
       Label1.Font.Style := [];
       Label1.ParentFont := False;
       Label2 := TLabel.Create(frmDesign);
       Label2.Parent := frmDesign;
       Label2.Left := 125;
       Label2.Top := 15;
       Label2.Width := 4;
       Label2.Height := 20;
       Label2.Caption := '15';
       Label2.Font.Color := clWindowText;
       Label2.Font.Height := -16;
       Label2.Font.Name := 'MS Sans Serif';
       Label2.Font.Style := [];
       Label2.ParentFont := False;
      end;

     procedure SafeInitForm;
      begin
       SetArrayLength(v, 0);
       ThreadSafeCall('InitForm', v);
      end;

     procedure ShowFormModal;
      begin
       frmDesign.ShowModal;
      end;

     procedure SafeShowFormModal;
      begin
       SetArrayLength(v, 0);
       ThreadSafeCall('ShowFormModal', v);
      end;

     procedure Showform;
      begin
       frmDesign.Show
      end;

     procedure SafeShowForm;
      begin
       SetArrayLength(v, 0);
       ThreadSafeCall('ShowForm', v);
      end;

    begin
     SafeInitForm;
     SafeShowFormModal;
     SafeShowForm;
     FreeForm(frmDesign);
    end.

    I can edit it if I stick "Label2.Caption := 'Number';" right after SafeInitForm, but if I make a progress report like this for one of my scripts, I'm going to need to edit it all the time.

    Am I not to use Labels for this type of thing? If not, what should I use?

    Please help, I'm new to forms

    -Mike

  2. #2
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey, three things:

    Your name is Mike, so you're cool. My name's Mike too .
    You listen to ska, so you're cool. I listen to ska too .
    You're new to forms. I am new to forms too .

    So, is what you are trying to do, is make something so that when you stop a script, a form pops up (or never leaves, I guess), and gives you your report instead of the Debug/Report box? Why would you want that? Just curious, I'm not insulting it. It's a good idea, just may be a little tough to pull off.

  3. #3
    Join Date
    Feb 2007
    Location
    SparklesProd.com
    Posts
    2,406
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    you could use edit boxes which are disabled,

    ie
    SCAR Code:
    edt1.enabled := false;
     edt1.text := 'blabla';

    But i cant see anything wrong with the label caption method

    Cant you just assign the caption to something just after it runs?

    You could just make a procedure that updates the captions whenever you want...

  4. #4
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by IEatJ00erBaybees View Post
    Hey, three things:

    Your name is Mike, so you're cool. My name's Mike too .
    You listen to ska, so you're cool. I listen to ska too .
    You're new to forms. I am new to forms too .

    So, is what you are trying to do, is make something so that when you stop a script, a form pops up (or never leaves, I guess), and gives you your report instead of the Debug/Report box? Why would you want that? Just curious, I'm not insulting it. It's a good idea, just may be a little tough to pull off.




    Not exactly. I want to keep a dynamically-updated, user-can-go-to-the-computer-at-any-time-and-see-how-good-the-script-is-going-without-ever-bringing-SCAR-up progress report. Understand?

    I'm not really sure it works like it should, though.

    Quote Originally Posted by Sp0rk-eh View Post
    you could use edit boxes which are disabled,

    ie
    SCAR Code:
    edt1.enabled := false;
     edt1.text := 'blabla';

    But i cant see anything wrong with the label caption method

    Cant you just assign the caption to something just after it runs?

    You could just make a procedure that updates the captions whenever you want...
    I think I can, but I'm not sure it'll update like it should. I don't really wanna start this without being sure it'll work/how to do it.

  5. #5
    Join Date
    Feb 2007
    Location
    SparklesProd.com
    Posts
    2,406
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    haha, trial and error my friend.

    99% of success is failure.

  6. #6
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Hah, alright

    That makes a good sig, btw...

    Lemme change it...

    Perfect.

  7. #7
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've always wondered that..seriously. I've seriously thought about suggesting that but never knew how difficult it would be. Do you mean like a small window that hangs in the corner? Like the report box hanging out in the corner of the screen for you to come by and just read? That's what I always wanted to suggest for SCAR Divi

  8. #8
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm, well I'm not sure how easy this would be to do with a form. But it should be quite simple using the debug image window that people use to make scar games.

    Play around with this. When you run it now, you should see a black box with white number counting to 10 in the middle. Basically you can just change the message to make it auto update your proggy.
    SCAR Code:
    program New;
    var
    ChatChars,c:integer;

    procedure paint;
    var
    buffer, message1:integer;
    begin
      buffer:= BitmapFromString(500, 400, '');//this is what we draw to before we draw to the actual screen. Helps make it look prettier
      message1:=CreateBitmapMaskFromText(inttostr(c), ChatChars);//we are going to be drawing bitmaps, so we need our message to be a bitmap.
      DisplayDebugImgWindow(500, 400);//displays our window with designated size
      FastDrawClear(buffer, clblack);//makes the buffer black
      FastDrawSizeTransparent(250,200,300,250, message1, buffer);//draws our message to the buffer starting at 250,200 (x1,y1) and bottom left coords are 300,250 (x2,y2)
      SafeDrawBitmap(buffer, GetDebugCanvas, 0,0);//draws everything in our buffer to the screen (the black background and the message)
    end;

    begin
    LoadChars('');
    ChatChars:=LoadChars2(AppPath+'CharsChat2\');//do this so that you can make the text into a bitmap
    repeat
    wait(500);
    paint
    c:=c+1;
    until(c>10)
    end.

  9. #9
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    @ IEJB

    I did suggest a while-running progress report for Divi

    @ Omgh

    I'll try that out, thanks

    Edit:

    Oooh, that's kinda cool

    I noticed that it doesn't stay on top all the time. Instead, it came back when a new number was written. Is that what it would do with the forms?

  10. #10
    Join Date
    Feb 2006
    Location
    London, England
    Posts
    2,045
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    You're best bet would be to work with the debug image box then and create a progress report on that, not in a form.
    SRL Wiki | SRL Rules | SRL Stats
    Ultimate SCAR Scripting Tutorial | Starblaster100's Auth System | Join the official SRL IRC now!


    Help Keep SRL Alive! Please disable Advert Blockers on SRL! Help Keep SRL Alive!


  11. #11
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ooh, actually I don't think you can do this. It does stay on top on my pc, dunno whats up with yours.

    The reason you can't do this though, is because scar will needs to have focus on runescape and be able to see the whole screen to actually macro. Sorry

  12. #12
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Starblaster100 View Post
    You're best bet would be to work with the debug image box then and create a progress report on that, not in a form.
    Why would that be my best bet?

  13. #13
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    that is what the code example I just gave you does. same thing

    It paints on to the debug image window.

  14. #14
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    But why should I not use forms? Star said my best bet would be the debug box. Not forms. Why?

  15. #15
    Join Date
    Jan 2007
    Location
    Skaville, Jamaica
    Posts
    1,117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    How about Client Transparency? If you make it transparent, then you can still see the "debug box".

    EDIT: 300th Post and I'm a Community Member now! Next step is Yellow Name

  16. #16
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Transparency doesn't make the window transparent. It is used so that when you make a bitmap, usually there is a some sort of background or box around it which you don't want, then you can set that color to be transparent, so you only get the image you need.

    Forms are bad because you can't update them without reloading the whole form. The debug window you can easily just repaint to.


    Edit:I'm happy that starblaster suggested the same thing I did

  17. #17
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    That might work.

    I do know Secet used forms and editing labels (I checked to see if they were labels after I posted this thread) in his Draynor Willow Banker. I'm just not sure what he did exactly to make it work.

    I guess I'll just make a simple Power Miner later tonight to test this on

  18. #18
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    YAY!

    I totally did this one time!

    Just hold on a minute, I'll remember how to do it very soon.

    EDIT:

    SCAR Code:
    program New;

    const
    ShowAll = true; //Do you want to know what the script's doing?

    var
    frmDesign : TForm;
    Label1 : TLabel;
    Label2 : TLabel;
    v: TVariantArray;
    one : TTIMER;
    lds, which : integer;

     procedure Time(Sender : TObject);
     begin
       if(which = 0) then
       begin
         Label1.Caption := 'Loads Mined: ';
         Label2.Caption := inttostr(lds);
         which := 1;
       end else
       begin
         Label1.Caption := 'Script has run for [x]';
         Label2.Caption := '';
         which := 0;
       end;
     end;

     procedure InitForm;
      begin
       frmDesign := CreateForm;
       frmDesign.Left := 255;
       frmDesign.Top := 137;
       frmDesign.Width := 214;
       frmDesign.Height := 89;
       frmDesign.Caption := 'Progress Report';
       frmDesign.Color := clBtnFace;
       frmDesign.Font.Color := clWindowText;
       frmDesign.Font.Height := -11;
       frmDesign.Font.Name := 'MS Sans Serif';
       frmDesign.Font.Style := [];
       frmDesign.Visible := False;
       frmDesign.PixelsPerInch := 96;
       Label1 := TLabel.Create(frmDesign);
       Label1.Parent := frmDesign;
       Label1.Left := 25;
       Label1.Top := 15;
       Label1.Width := 100;
       Label1.Height := 20;
       Label1.Caption := 'Initializing';
       Label1.Font.Color := clWindowText;
       Label1.Font.Height := -16;
       Label1.Font.Name := 'MS Sans Serif';
       Label1.Font.Style := [];
       Label1.ParentFont := False;
       Label2 := TLabel.Create(frmDesign);
       Label2.Parent := frmDesign;
       Label2.Left := 125;
       Label2.Top := 15;
       Label2.Width := 4;
       Label2.Height := 20;
       Label2.Caption := '';
       Label2.Font.Color := clWindowText;
       Label2.Font.Height := -16;
       Label2.Font.Name := 'MS Sans Serif';
       Label2.Font.Style := [];
       Label2.ParentFont := False;
       one := TTIMER.Create(frmDesign);
       one.Interval := 1000; //Change the display every 1 second
       one.Ontimer := @Time;
       AddToReport('TTimer created');
      end;

     procedure SafeInitForm;
      begin
       SetArrayLength(v, 0);
       ThreadSafeCall('InitForm', v);
       AddToReport('Form Initialized');
      end;

     procedure ShowFormModal;
      begin
       frmDesign.SHOW;
       AddToReport('Form Shown');
      end;

     procedure SafeShowFormModal;
      begin
       SetArrayLength(v, 0);
       ThreadSafeCall('ShowFormModal', v);
      end;

      procedure ScriptStuff;
      var
        x: integer;
      begin
        for x := 1 to 50 + random(10) do
        begin
          if(random(5) = 1) then
          begin
            lds := lds + 1;
            if(showall)then
              AddToReport('Load Mined');
          end else
            AddToReport('Load Not Mined');
          wait(250 + random(250));
        end;
      end;

    begin
     ClearDebug;
     if(ShowAll)then
       ClearReport;
     SafeInitForm;
     SafeShowFormModal;
     writeln('And the script runs on...');
     ScriptStuff;
     writeln('And the script ends.');
     FreeForm(frmDesign);
    end.

    (note: the ttimers used are not essential, but they are very helpful)
    Interested in C# and Electrical Engineering? This might interest you.

  19. #19
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Haha

    Awesome!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Progress Reports!
    By skilld u in forum Outdated Tutorials
    Replies: 10
    Last Post: 05-17-2008, 04:25 AM
  2. progress reports
    By sukomabawls in forum RS3 Outdated / Broken Scripts
    Replies: 2
    Last Post: 07-14-2007, 03:15 AM

Posting Permissions

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