Home   Help Search Login Register  

Author Topic: stringtable tutorial  (Read 8447 times)

0 Members and 1 Guest are viewing this topic.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:stringtable tutorial
« Reply #15 on: 20 Nov 2005, 02:18:23 »
I never managed to make it work with the mission name, I suspect because I only checked campaign missions.  I've just looked at acouple of single missions and sure enough, they use the @ spell.    However, from what you say klavan, I'll have to test it and see if it really works.   Thanks for the heads up 456.

I thought about an example mission and although in general I'm a huge fan, in this case I'm not so sure.    It involves a whole description.ext, and remember this is a basic tute - half the people who read it won't have worked out description.ext yet, and I don't want to confuse them or put them off.

One thing bothers me.   If stringtable really is a simple little file, how come writing the tute is such a big job?  

Precisely.
Plenty of reviewed ArmA missions for you to play

klavan

  • Guest
Re:stringtable tutorial
« Reply #16 on: 20 Nov 2005, 10:02:06 »
@mac
I've made the same thoughts about an eventual mission yesterday evening, and i came with the same conclusion: the risk to add confision to a (potentially) already confused newbie is high.

Quote
One thing bothers me.  If stringtable really is a simple little file, how come writing the tute is such a big job?

I think you've got it. The tute is clear for me (well, i already know what's a stringtable), well written and totally understandable. Better to avoid to fill it with lots of additional info: for example you could add that with the stringtable you can change the default name's of the groups in OFP, but for me it's better to let the neo mission maker to search a specific tute for this, after he will be able to handle the basic functions of the .csv.
Klavan

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:stringtable tutorial
« Reply #17 on: 21 Nov 2005, 22:00:07 »
New and hopefully final version up in the first post.    I've added a very simple demo mission, without a description.ext.   This seems to be to be the least of several evils but I'm open to opionions.

It does work in the name field - use @.
Plenty of reviewed ArmA missions for you to play

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:stringtable tutorial
« Reply #18 on: 22 Nov 2005, 01:12:15 »
Just before you start mentioning columns in a majorly way, say this:

The contents of a stringable are separated into columns. A column is defined by a comma. In Excel, this is done automatically for you, and the comma is hidden.


@Anything

$Anththing

@ is a little dangerous as it will treat certain characters inside the string in a special manner. For a wannabe just-get-the-bloody-thing working newbie they're better off with $

>Do not use quotation marks in the stringtable unless you want to them to appear on the screen

this is WRONG. This is an invention of $#@_)*_)*$@_ Excel

quotes are stripped and are absolutely necessary to disguise commas

#$*&)()$#@$@0 Excel Actually inserts """ anything """

You are disguising and writing a tutorial for Excel, not, for stringtable csv
Just say no to bugz

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:stringtable tutorial
« Reply #19 on: 22 Nov 2005, 11:42:57 »
Quote
Just before you start mentioning columns in a majorly way, say this:

The contents of a stringable are separated into columns. A column is defined by a comma. In Excel, this is done automatically for you, and the comma is hidden.
Done.

Quote
@ is a little dangerous as it will treat certain characters inside the string in a special manner. For a wannabe just-get-the-bloody-thing working newbie they're better off with $
$ doesn't work - I've checked.   You have to use @ for markers and the mission name.   However I will add a warning about @.

Quote
>Do not use quotation marks in the stringtable unless you want to them to appear on the screen

this is WRONG. This is an invention of $#@_)*_)*$@_ Excel

quotes are stripped and are absolutely necessary to disguise commas

We need to get this bit clear.    My underlying point (which I will rewrite) is that as a rule you do not put quotes in stringtable.   When you do, it is in special circumstances.  

One circumstance is when you want the quotation marks to appear on the screen.   In Excel, you put one set of quotes in the cell and one set of quotes appear on the screen.    When I look at the file in Notepad, I see it has 3 sets of quotation markes to make one set appear on the screen

Screen             Excel cell               Notepad

"test"                "test"                  """test"""
here, test         here, test             "here, test"

(I had forgotten it, but I first encountered .csv format 20 years ago and comprehending it was well beyond my intellectual capacity.   Nothing has changed.  *sigh*)

What do you use two sets of quotes for?   Are there other similar things we should mention?


Is the following true?

Leading and trailing spaces are stripped out in .csv format.   In other words:-
,            test       ,    == ,test,



Quote
You are disguising and writing a tutorial for Excel, not, for stringtable csv
Yes I know, that's why I need your advice.  
« Last Edit: 22 Nov 2005, 12:05:38 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:stringtable tutorial
« Reply #20 on: 22 Nov 2005, 12:12:05 »
in any csv file (for flashpoint) the following are identical and synonomous

,"Hello there",

Hello there

the engine itself strips and ignores the "

In point of fact it is a 'good habit' (tm) for a user to write quotes around strings

"this", "that", "the other"

This because there are instances when the characters betwen quotes are literal and not to be interpreted. Some examples

,"Morning Captain, what news?",

,"     Intentional space indent",

,"Well here's a %%% funny one",

last example to avoid % being interpreted

$STR_BriefingName is valid (and I assume @STR_Name too).
Just say no to bugz

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:stringtable tutorial
« Reply #21 on: 22 Nov 2005, 12:16:44 »
Excel writes

|     marbles|

as

, "   marbles",

hence it *appears* leading space is signficant when it is not.

Just say no to bugz

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:stringtable tutorial
« Reply #22 on: 22 Nov 2005, 12:31:38 »
How does this sound Mac?



Quote characters are treated in a special manner as an escape literal. All text up to the next quote is not to be interpreted in any way. Thus any leading or trailing space between quotes is not filtered out, a comma is not treated as an end of field, and the % characters are not interpreted as such. The text between quotes appears literally on the screen (without the quotes).

To actually embedd a real, genuine, literal quote, the same rules apply

""" means interpret the single quote, between quotes, as a literal and display it!



<phew>

Just say no to bugz

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:stringtable tutorial
« Reply #23 on: 23 Nov 2005, 11:33:44 »
Perhaps
Quote
$STR_BriefingName
should work, but it doesn't.    At least not for me, neither for mission name nor markers.




I still have a long way to go but I have found a website which has helped me understand why I find csv so fiendishly difficult to comprehend.

http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm

I've only read it twice so I don't yet fully understand what's what, but I at least I have worked out what at the is at the bottom of my confusion.   (I hope.)  Everybody says that in .csv format values are separated by commas.   This is false.    Commas do not separate values.    They are merely used[/b] in separating values.   They are a flag, if you like:  a warning that you might be at a new value.  

Now that I've realised that, I can figure out what does separate values.  

Edit:  actually no, first I have to figure out the definition of what constitues a valid value.

Edit: actually no, what I really have to do is figure out what the commands are in csv


Notes to self (somebody tell me if any of these are wrong)

  • The value separator is a comma preceded in the whole document by an even number (including zero) of double quotation mark characters.  It returns nothing.
  • "x where x is any character other than " returns nothing.  Means

1) this is the start/end of a value or
2) a command character within the current value will follow either immediately or later and it is simply to be returned without carrying out the command


  • "" returns " providing it is preceded within the value by " otherwise it is invalid.  
  • A space character returns

1) space if it is within a value or
2) nothing if it is outside a value

  • The start and end of a value is defined with one of the following

1) "
2) any alphanumeric character
3) most punctuation but not a comma
4) """

  • "" at the start of a value is not valid unless followed immediately by "
  • There are five types of character in a .csv file.   All characters belong to more than one type.  


A character may

1) return itself
      - autonomously (e.g. ordinary alphanumeric)
      - in association with command characters (e.g. one " from a set of "; non-separator comma, space)
      - because it is a command which returns itself as well as doing its command job (e.g. first or last characters in a value)

2) return nothing
      - because it is a command (e.g. separator comma, some ") which returns nothing
      - because it is a space outside a value


  • There are subtleties involving @ but I have not yet encountered these
  • Ditto %



(The source of the difficulty is becoming ever clearer.   Nobody ever defines what characters mean:  they only tell you how to do certain things.   This was particularly true at my last run in with .csv.   Isn't it funny how certain things - such as this file format - totally corrupt the normal way of doing things?    Actually to call it a file format is itself almost misleading:  it is a coding language.    .csv is not a simple format:  it is a complex one.  So complex, that people shy away from attempting to describe it.    Instead they describe things you can do in it.   Which is like trying to explain swimming to a Martian without telling him what water is.)


This is good.  Making real progress here.

« Last Edit: 23 Nov 2005, 13:32:46 by macguba »
Plenty of reviewed ArmA missions for you to play

i.Q

  • Guest
Re:stringtable tutorial
« Reply #24 on: 27 Nov 2005, 23:00:34 »
i am not sure if you aware of this.

it seems that stringtable reference can be used for any string.
i only tested main config - not missions.
yet you can do some very nice things with this  ;)

also by Komuna
But you can put functions in a string table!
and do something like:
player call (localize "$MY_FUNCTION")

like
well think about the basic idea of the stringtable
have different configuration by the language setting
you could make easy ofp, realism ofp, action ofp - by choosing the corresponding "language"
or even some performance settings.

example
STR_DN_M1A1_WEAPON,Gun105,,,,,,
STR_DN_M1A1_AMMO1,Heat105,,,,,,
STR_DN_M1A1_AMMO2,Shell105,,,,,,

 
weapons[]={$STR_DN_M1A1_WEAPON,"MachineGun12_7"};
magazines[]={$STR_DN_M1A1_AMMO1,$STR_DN_M1A1_AMMO2,"MachineGun12_7"};
m1a1 does have m60 weaponry

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:stringtable tutorial
« Reply #25 on: 04 Dec 2005, 14:29:10 »
What I would be interested in knowing is about that functions stored in the stringtable idea...
Mainly, would it be more effective to use that instead of preprocessFile/loadFile?
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mikero

  • Former Staff
  • ****
  • ook?
    • Linux Step by Step
Re:stringtable tutorial
« Reply #26 on: 05 Dec 2005, 01:11:47 »
In offline discussions with MacGuba, where we agreed he could poke my left eye out, if I could pull both his ears down to his kneecaps, I've realised (now) that we have in fact two separate 'documents'

this, is a discussion on a TUTORIAL, as in Howto

the following reference is a submission to ed depot on the FILE FORMAT of csv and really is chalk and cheese.

http://www.ofpec.com/editors/resource_view.php?id=913

Originally Mac & I assumed we'd merge the 'same' writeups into a common one. I don't believe that was in fact a correct assumption.

If anyone believes _that_ document needs further discussion/revision, I'll open a separate thread.

« Last Edit: 05 Dec 2005, 01:13:45 by Mikero »
Just say no to bugz

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:stringtable tutorial
« Reply #27 on: 05 Dec 2005, 12:41:02 »
Yes I think you've hit the nail on the head.
Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:stringtable tutorial
« Reply #28 on: 06 Jan 2006, 09:01:51 »
the reason why STR is a fixed in concrete label is that the engine knows to specifically look in STRingtable.csv as opposed to any other.
This is actually not entirely true.. At least when using localize (haven't tested $ or @ yet)..

If you use stringtable.csv in an AddOn .pbo it gets loaded when OFP starts (ok, if it's in a mod folder that's not 'selected' then it will not) and you can then refer to the strings in it without the STR_..

For example in the new MCAR Engine we have an entry in the stringtable:
Code: [Select]
MCAR_getLD,"if(canMove _this)then{[_this] call(localize ""MCAR_getLaunch"")}else{[_this] call(localize ""MCAR_noCrewInHumvee"")}",gets gamelogics position and direction

which is called in a script with:
Code: [Select]
_ammo = _shooter call (localize "MCAR_getLD")
Same goes for the config.cpp, we call an stringtable entry in an eventhandler:
Code: [Select]
init = "[_this select 0] call (localize ""MCAR_createProxyAT"");
I then made an small test addon with stringtable in it and used a trigger in a mission to localize it and it worked, without the STR_...

But strintable.csv in missions are a different matter..
« Last Edit: 06 Jan 2006, 09:03:00 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline bdfy85

  • Contributing Member
  • **
Re:stringtable tutorial
« Reply #29 on: 07 Jan 2006, 15:29:26 »
Quote
* Schools of thought ...
mikero - Don't use Excel.   That &*)#@_($£! program is the single reason why people are finding this incredibly straightforward file so difficult to understand.  The best method is simply to use Notepad.
macguba - I'm a spreadsheet man myself.
Just use whatever you find easiest.

By default in windows csv files associated with MS Excel. THat's why most people tries to edit *.csv in Excel first.  But Excel 2003 (I do not have other versions at the moment ) adds extra commas to the every line of csv (but you can't see  these commas in Excel ) after saving.  After this stringtable won't be recognized by game and user don't see any errors.
This "bug" is ultimate trouble maker for users. At flashpoint.ru I see newbie questions about this routinely.
Thus IMHO the best idea for a tute is to prohibit user from using Excel.
« Last Edit: 07 Jan 2006, 15:30:09 by bdfy85 »
Liberation Mod scripts&balance