User Tag List

Results 1 to 8 of 8

Thread: Using Global Strings embedded in larger strings

  1. #1
    No Products Registered

    Join Date
    Mar 2008
    Location
    Seattle, WA
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Global Strings embedded in larger strings

    I'm currently working on a game with lots of scripted dialogue. One of the features of the game is that we are having players create their own characters. These characters will interact with NPC's. We want the NPC's to be able to display large amounts of text while speaking directly to the player's character.

    However in order to make the dialogue sound more realistic we need the ability for the NPC's to address the player by the NAME they've chosen and the GENDER they've chosen. I'm using Global Strings to hold both of them.

    Here's some sample text that illustrates what I'm trying to achieve:

    "Hello $NAME, we've been expecting you. Please take a seat and make yourself comfortable. It's been a while since we've had the company of a good $GENDER at our humble camp..."
    I'm a bit stumped on how to achieve this. The String Object can handle large paragraphs and lots of them but it seems very limited in the ability to format individual words (bold, italic, etc.). The Formatted Text Object seems a bit better as I can create the dialogue for my NPC's using Rich Text files (.rtf) and format it with more options then the previously mentioned String Object.

    However, both of these methods don't seem to allow me to insert Global Strings and have them embedded inside of the paragraphs and/or rich text files.

    Would anyone have any suggestions on how this could be done? I'd deeply appreciate this! :/

    -Mudstick

  2. #2
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    2,997
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    Re: Using Global Strings embedded in larger strings

    This is how I am doing it.

    All my strings are stored in a Magic Deque object. If don't already know what it is, it's a kind of array extension. But you could use another extension.
    The player's name is inserted in the strings where needed by using the all mighty String Parser extension, which has very powerful functions.
    Then in the actual game the object displaying the strings (String, Formatted Text, Text Blitter, whatever..) loads them from Magic Deque. Et voilà!

  3. #3
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,515
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)

    Re: Using Global Strings embedded in larger strings

    Use the SubString Replace object, perhaps.
    .:::.Joshtek.:::.

  4. #4
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    2,997
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    Re: Using Global Strings embedded in larger string

    In your case you'd use the replace function like this:

    Code:
    String Parser: Set source string to "Hello $NAME, we've been expecting you."
    String Parser: Set source string to replace$( "String Parser", "$NAME", Global String A)

  5. #5
    No Products Registered

    Join Date
    Mar 2008
    Location
    Seattle, WA
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using Global Strings embedded in larger string

    Thanks everyone for the great suggestions!

    *cheers*


  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jun 2007
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using Global Strings embedded in larger string

    I'm curious...

    Is there a reason to recommend the string parser object over simple concatenation for this?

    which would look like:
    "Hello "+ global string A +" we've been expecting you. Please take a seat and make yourself comfortable. It's been a while since we've had the company of a good "+ global string B +" at our humble camp..."

    Dave


  7. #7
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using Global Strings embedded in larger string

    It is best not to hard-code these things.

  8. #8
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    2,997
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    Re: Using Global Strings embedded in larger string

    Yes for numerous reasons it's better to not hardcode chunks of texts. By loading external files you get easier/better portability, update, localization etc..

Similar Threads

  1. Scan Global Strings and Other strings
    By Ausomeman in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th May 2010, 04:01 PM
  2. Global Values and Strings
    By xXjbroXx in forum Multimedia Fusion 2 - Technical Support
    Replies: 19
    Last Post: 23rd April 2010, 12:05 AM
  3. Global Strings
    By Brandon in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 1st October 2007, 07:06 AM
  4. Global Strings
    By gamefreak202 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th May 2007, 09:36 PM
  5. 241_MMF2dev -Global strings refusing being global
    By Tiny in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 19th July 2006, 07:00 PM

Posting Permissions

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