OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: kueter on 13 Jun 2004, 00:23:39

Title: Custom text in missions and cutscenes
Post by: kueter on 13 Jun 2004, 00:23:39
Hiya ofpec bros, :D
          I have seen intros and missions with text that appears on screen like a typewriter or computer is doing it.  Anyone know how to do this?  ???

Thanks,
Kuet
Title: Re:Custom text in missions and cutscenes
Post by: macguba on 13 Jun 2004, 01:48:35
xenofanes font text tutorial in the Editors Depot.

If you mean stuff appearing one letter at a time, as if it is being typed "live", then its just a string of titletexts

h
ha
hal
hall
hallo
Title: Re:Custom text in missions and cutscenes
Post by: kueter on 13 Jun 2004, 02:39:36
Thanks, macguba. I will check it out.
Title: Re:Custom text in missions and cutscenes
Post by: Blanco on 14 Jun 2004, 22:53:17
If you want a real typewriter effect, download the COC tomahawk and check the intro of the demomission.

It's advanced stuff, but it's worth to check.
The scrolltext is created in a dialog :

this is the scrollscript :

Code: [Select]
;scroller.sqs
_array = _This select 0
_baud = _this select 1
_IDC = _this select 2
_currenttext = ""
?IsScrolling > 0:goto "PenaltyBox"
#Start
IsScrolling = _IDC
_wait = 10/_baud
_i = 0
#Loop
CtrlSetText [_IDC, _currentText + "_"]
?_i >= count _array: goto "endflash"
~_wait + random 0.2
_currentText = _CurrentText + (_array select _i)
_i = _i + 1
playsound "scrollclick"
goto "Loop"

#EndFlash
playsound "CMBeep"
_i = 0
#Blinker
~_wait
CtrlSetText [_IDC, _currentText + ""]
~_wait
CtrlSetText [_IDC, _currentText + "_"]
_i = _i + 1
?_i < 2:goto "Blinker"
~_wait
DoneScrolling = _IDC
#SecondLoop
CtrlSetText [_IDC, _currentText + ""]
~_wait
?(IsScrolling != _IDC) or (!Dialog):exit
~_wait
CtrlSetText [_IDC, _currentText + "_"]
goto "SecondLoop"

#PenaltyBox
@DoneScrolling == _IDC - 1
goto "Start"


this is the description.ext

Code: [Select]
#define FontS "tahomaB24"
#define FontM "tahomaB36"
#define FontP "tahomaB48"
#define FontHTML "courierNewB64"
#define FontHTMLBold "courierNewB64"
#define FontMAP "courierNewB64"
#define FontMAIN "SteelfishB64"
#define FontTITLEHalf "SteelfishB64"
#define FontMAINCZ "SteelfishB64CE"
#define FontTITLE "SteelfishB128"
#define FontBOOK "garamond64"
#define FontNOTES "AudreysHandI48"


#define CT_STATIC 0
#define CT_HTML 9

#define ST_LEFT 0
#define ST_RIGHT 1
#define ST_CENTER 2
#define ST_UP 3
#define ST_DOWN 4
#define ST_VCENTER 5

#define ST_SINGLE 0
#define ST_MULTI 16
#define ST_PICTURE 48
#define ST_FRAME 64

#define ST_HUD_BACKGROUND 128
#define ST_TILE_PICTURE 144
#define ST_WITH_RECT 160
#define ST_LINE 176

#define ST_SHADOW 256
#define ST_NO_RECT 512


////SOUND CLASS////

class CfgSounds
{
sounds[] = {CMBeep, scrollclick};

   class CMBeep
   {
      name = "CMBeep";
      sound[] ={"\sounds\beep.wav",db-20,1};
      titles[] = {};
   };

class scrollclick
   {
      name = "ScrollClick";
      sound[] = {"\sounds\click.wss", db-30, 1};
      titles[] = {};
   };

}

class RscBasic
{
  idc = -1;
  x = 0; y = 0; w = 0; h = 0;
  text = ;
  style = 0;
};
class RscText : RscBasic
{
        type = 0;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {1,1,1,1};
        font = "tahomaB24";
        sizeEx = 0.02;
};
class RscCreditScreen : RscText
{
          font = "courierNewB64";
       sizeEx = 0.02
          colorText[] = {.3,1,.3,1};
};


class DlgCredits
{
  idd = -1;
  movingEnable = true;
  controlsBackground[] = { BGS};
  class BGS : RscText
  {
     colorBackground[] = {0.0,0.0,0.0,0.0};
     text = ;
     x = 0; y = 0; w = 1; h = 1;
  };

/////SCROLLTEXT/////////////////////////////////////////////
 
  objects[] = {};
  controls[] = {TXT1};
 


 class TXT1: RscCreditScreen
  {

    idc = 101;
/// text start scrolling on the left top of your screen
    x = 0.0; y = 0.0; w = 1.0; h = 0.08;
    text = ;
  };
};


This is the script twhere i activate the scrolltext :
1th param is an array with the characters
Every single character (also spaces en comma's) has to be placed between quotes!!
Boring job, I can tell ya!
Second param is the scrollspeed
Third param is the IDC (in this example 101)

Code: [Select]
;scrolltest.sqs
_frame = createdialog "DlgCredits"


[["S","C","R","O","L","L","T","E","X","T"," ","I","N"," ","O","P","E","R","A","T","I","O","N"," ","F","L","A","S","H","P","O","I","N","T"], 80, 101] exec "scroller.sqs"

@donescrolling == 101
~3
IsScrolling = -1
donescrolling = -1
~1
closedialog 0

This is only one sentence. When you want more you have to define the text (idc, position) in the description.ext.