Jump to content

Concatenation


Lauriel

Recommended Posts

What I thought would be easy ... well, that's just never the case, is it.  How would I go about concatenating a literal string with a string from a .tra file.  Like:

myNewString = ~I say 'tomato' but you say ~ + @900000

I tried the caret (^), but that's just for 2 literals.  I tried PLUS, I tried the plus sign, I tried... I don't remember everything I tried.  Help?

Link to comment

Erhm, you are done nothing good.

As in, what does this entail ? A dialog ? .d file ? A script string display ? Erhm flying eyes in a dream state...

The ++ ~dialog phrase 1~ + ~dialog phrase 2~ ... can be done, but in a .d file involving CHAIN ... and those plusses are abbreviation of other functions.

Edited by Jarno Mikkola
Link to comment
1 minute ago, Jarno Mikkola said:

Erhm, you are done nothing good.

As in, what does this entail ? A dialog ? .d file ? A script string display ? Erhm flying eyes in a dream state...

The ++ (dialog phrase) + (dialog phrase) ... can be done, but in a .d file involving CHAIN ...

This is in a .tp2 file that inserts proper and upper case player1 pronouns into tokentxt 2da file and is used to build the line that is inserted into the table, allowing for multiple languages so it can be used in dialogues like: ~my dialogue line <UPPER_LORDLADY>~

Link to comment

First, you have to get the text corresponding to the tra reference -- there is a piece of black magic hackery (e.g. I use, but I do not really grok it) in IR to do this. Second, you have to concatenate the two strings. You would imagine weidu had a function for this: it does not (or if it does I have not found it). You have to sum the lengths of the two strings, create a buffer of that size, then WRITE_EVALUATED_ASCII the strings into it. Not difficult but... sigh.

Edited by grodrigues
Typos
Link to comment

Wait, there is a better solution (I knew there had to be). Check the docs on SPRINTF (if you have coded in C this should be familiar) and use "%s%s" with the two variables as arguments. Do not forget to change the tra ref into text -- the code for this is in Item Revisions somewhere. If you can't find it, I have stolen it for my mods and can put it in here.

Edited by grodrigues
Link to comment

Ahh, I vaguely remember SPRINTF.  It's been a couple decade....  I would never have thought of that.

4 minutes ago, grodrigues said:

Do not forget to change the tra ref into text -- the code for this is in Item Revisions somewhere. If you can't find it, I have stolen it for my mods and can put it in here.

  And please, yes, share, please :)  If you can find it.  I just want to be able to share this with folks and move on to my actual mod.  LOL

Link to comment
2 minutes ago, subtledoctor said:

Was going to say, you could also inline a text file, copy it to a workspace directory, and then APPEND_OUTER lines of text to it. (That adds a line break though.) I do that in several mods. It depends on precisely what you want to achieve. 

Oh my goodness!  What we will do to bash Weidu over the head to let us do what we want to do!  LOL

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...