Results 1 to 7 of 7
  1. #1
    0rbit's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Ireland.
    Posts
    212
    Reputation
    15
    Thanks
    720
    My Mood
    Amused

    Cool [Delphi] MW2 Text Cycle Effect

    Hey all. Recently coded this up just to see if I could. Well I could, so here ya go:

    Code:
    procedure mw2Cycle(Canvas:TCanvas;s:string;PosX,PosY,TimePerChar:Integer;bgCol:TColor;Font:TFont);
    var
      i,j:integer;
      om:integer;
      output,r:string;
    label
      m;
    begin
      canvas.Font:=Font;
      if s='' then s:='Lol why so blank?';
      r:='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !"$%^&*()-_=+{[}]:;@''~#?/>.<,|\`׃Ѫäյݯ=';
      output:=' ';
      om:=1;
      m:
    
      i:=1;
      while (i<TimePerChar) Do
      begin
         Application.ProcessMessages;
         Randomize;
         j:=RandomRange(1,Length(r));
         output[om]:=r[j];
    
         With Canvas do begin
          Brush.Color:=bgCol;
          fillrect(cliprect);
          Brush.Style:=bsClear;
          TextOut(PosX,PosY,output);
         end;
    
         inc(i);
      end;
    
      output[om]:=s[om];
      With Canvas do begin
       Brush.Color:=bgCol;
       fillrect(cliprect);
       Brush.Style:=bsClear;
       TextOut(PosX,PosY,output);
      end;
    
      if Length(s)<>Length(output) then
      begin
       output[om]:=s[om];
       output:=output+' ';
       Inc(om);
       goto m;
      end;
    
    end;
    Example call:
    mw2Cycle(Image1.Canvas,'Modern Warfare 2',0,0,200,clBlack,f);

    (Where "f" is a TFont which has already been created).

    The above gives the effect seen in text when you, for example, complete a challenge in-game, with the cycling text.

    Now, this is a "big" version which can be cut down easily (ie. You could just pass the Canvas and string, hardcoding the rest in the procedure).

    Okay, explaining time (for anyone who wishes to convert this to another language for example).

    Basic idea behind this:
    • Have input / output / constant strings
    • The final output = input
    • In between, however, the output will contain random characters, selected from our constant string
    • Once the time has run out for the first character (eg. 2 seconds), we set it to the correct value (from the input), and move on to the next one. Repeat until output=input

    "r" is out Constant String variable, which is used for holding our random characters. It contains all the characters we could need (A-Z,a-z,0-9,"Regular" Symbols), and many, many other ASCII characters. These extra characters may never be used by someone using the procedure, however they look good as they shoot past

    We start by giving output (a string variable) a value of a space. This gives us a base to work from as we'll be referencing the characters like output[i]. If output was left blank this would cause problems.

    Next we do our loop for the first character. The loop is repeated until the time is complete (eg. 2 seconds). We select a random character from "r", and set output's first character to this. We then print this character. For the whole 2 seconds we do this over and over again. Once the time is up, we set the character to its correct value, and print it.

    Next we check if length of output=length of input. If it is, we're done. Otherwise we add a space to output, and go back to the label m (think of a jne in asm). Just below m is our loop. The loop is done again, this time for the next character. This paragraph is repeated until length of output = length of input. Once it is, we're done.

    So yeah, that's basically it. I've attached a demo .exe to show what this does when the procedure is called, allowing you to change the font/colours/speed. Don't dream of setting speed to like...90 or you'll be sitting there for days (Someone learned this the hard way )
    Coders: Note that in this demo the speed (timePerChar) entered by the user is multiplied by 100 before use. Default is 2, so the procedure's "default" would be 200. The credits is called with a value of 100.

    If you don't understand anything here or need help, feel free to ask. I don't bite...usually



    I know this isn't exactly CoD development, but there isn't a Delphi section, and this would be more appreciated by people in the CoD programming section than those in "Other Programming" in my opinion, so I've posted it here for CoD people to see Sorry if I'm wrong.


    Virus Scans for the Demo:
    VirusTotal: 0/39 (0%)
    VirScan.org: Scanners did not find malware!

    Screenshot here.

    Enjoy!
    - 0rbit
    Last edited by 0rbit; 07-02-2010 at 08:00 AM.

    I read all PMs and VMs.
    If you add me on MSN, PM me here so I know who you are, or I will not accept.

    Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)
    My Stuffs: IWIFix v1.11 | HLoad v1.00b | MW2Hack v1.0 Final | [Tut] Ingame Console/Textbox in DirectX
    Current status: Being awesome.. Duh

  2. The Following 3 Users Say Thank You to 0rbit For This Useful Post:

    jabbathehutt (07-02-2010),Skyline. (07-08-2010),Someone01 (12-31-2015)

  3. #2
    Abstract's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Look in your refrigerator
    Posts
    3,626
    Reputation
    54
    Thanks
    980
    Upload the image to imageshack, this isnt a image hosting page

  4. #3
    0rbit's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Ireland.
    Posts
    212
    Reputation
    15
    Thanks
    720
    My Mood
    Amused
    That okay for you now, sire?

    I read all PMs and VMs.
    If you add me on MSN, PM me here so I know who you are, or I will not accept.

    Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)
    My Stuffs: IWIFix v1.11 | HLoad v1.00b | MW2Hack v1.0 Final | [Tut] Ingame Console/Textbox in DirectX
    Current status: Being awesome.. Duh

  5. #4
    EndRiT's Avatar
    Join Date
    Dec 2005
    Gender
    male
    Location
    USSR
    Posts
    12,751
    Reputation
    170
    Thanks
    4,294,967,295
    File approved.

  6. The Following User Says Thank You to EndRiT For This Useful Post:

    0rbit (07-03-2010)

  7. #5
    1OneShot's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    My Mood
    Amazed
    just tell me please how to use it?
    put that code in _rank.gsc?

  8. #6
    0rbit's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Ireland.
    Posts
    212
    Reputation
    15
    Thanks
    720
    My Mood
    Amused
    Quote Originally Posted by 1OneShot View Post
    just tell me please how to use it?
    put that code in _rank.gsc?
    No, this is Delphi code (for an EXE). It's not for MW2 itsself.

    I read all PMs and VMs.
    If you add me on MSN, PM me here so I know who you are, or I will not accept.

    Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)
    My Stuffs: IWIFix v1.11 | HLoad v1.00b | MW2Hack v1.0 Final | [Tut] Ingame Console/Textbox in DirectX
    Current status: Being awesome.. Duh

  9. #7
    parkerman111's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    :O
    Posts
    9
    Reputation
    10
    Thanks
    1
    thx, that helped

Similar Threads

  1. PREVIEW MW2 MAP sound effects
    By jflash in forum Combat Arms Mod Discussion
    Replies: 6
    Last Post: 02-27-2011, 01:18 PM
  2. [Request] COD MW2 Hit Effects
    By jflash in forum Combat Arms Mod Request
    Replies: 4
    Last Post: 02-15-2011, 11:38 PM
  3. MW2-Style Text
    By edub18 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 0
    Last Post: 10-08-2010, 09:22 AM
  4. [HELP!] MW2 text issue!
    By asdf12345678 in forum Suggestions, Requests & Help
    Replies: 1
    Last Post: 09-12-2010, 06:21 AM
  5. Cool blue text effect
    By dav96cool in forum Tutorials
    Replies: 2
    Last Post: 09-23-2009, 01:08 PM

Tags for this Thread