The Daily Click ::. Forums ::. Klik Coding Help ::. Super basic noob question on MMF2 and string parser
 

Post Reply  Post Oekaki 
 

Posted By Message

Verdigriss



Registered
  10/02/2014 00:04:44
Points
  5
11th February, 2014 at 11/02/2014 02:54:01 -

Hello all,
I'm just getting started with Multimedia Fusion 2 and I've run into a bit of a snag. I've got a name entry field that takes the entered string as the global string 'playername', and I want to have text in later frames refer to this. For example, you might enter 'Alex' as the player name, and the text might say 'And then [playername] died', and when you run the program it would replace [playername] with the global string and say 'And then Alex died'. I'm limiting the 'playername' to between 1 and 10 characters long, and I want the text to be properly formatted regardless of the length of 'playername'. I've looked everywhere I could for information on this, and it looks like I should use the string parser extension, which I installed, but I can't understand how to use. I can put the text object and the string parser object on the frame, but I don't know how to make the string parser object do anything to the text. I've tried looking at examples and opening up the event editor, but I'm not sure what to do with 'set source string' or how to make the parser's output appear onscreen. I'd really appreciate any help you could give. Thanks!

 
n/a

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
11th February, 2014 at 11/02/2014 07:10:19 -

Hello,

So you're just trying to reference the global string in the middle of a sentence? You don't need the string parser for that.

Pretend your characters name is Cloud and is stored in Global String Slot A. You would set your string up like so:

"Hello," + " " + Global String A + "!" + " " + "Long time no see!"

This would display the following:

Hello, Cloud! Long time no see!

Hopefully that helps. You can string strings together (lol) with the + sign

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
11th February, 2014 at 11/02/2014 16:45:36 -

Just a couple of other things to add to what Gamester said...

The "Str$()" function lets you convert a value to a string. So for example, if you might want to say something like:
"The slime monster attacks Player1 for " + str$( AtkDmg("Slime") ) + " damage. Player1 has " + str$( HP("Player") ) + " health remaining."

There's also the "substring replace" extension, which may be useful for things like this - but mainly if you have a lot of dialogue stored in external files, which is probably a bit too advanced for now.

 
n/a

Verdigriss



Registered
  10/02/2014 00:04:44
Points
  5
11th February, 2014 at 11/02/2014 23:46:17 -

Guys, thanks for the responses. GamesterXIII, yes, that's exactly what I'm trying to do. Do you mean just put a string object in the frame with that text in it? I made a new application, stored the name Cloud in Global String A, and then made a string object in a frame with that text in it, and when I ran the app it just showed the unmodified text. Is there something obvious I'm missing about how to make a string 'resolve' or 'interpret' or whatever?

 
n/a

Riptide



Registered
  26/07/2013 21:07:20
Points
  101
12th February, 2014 at 12/02/2014 07:53:28 -

Hi there, youre missing something but what ? Anyways retry that
1. Create a string object called 'string' (you can put text that doesnt matter)
2. Set and rename the alterable string A 'playerName' and set your text in it
3. Create a new event

Start of frame:
> 'string':Set alterable string to (''Hello '' + playerName + '', nice to see you again !'')

Hope that helps, cya

Edited by Riptide

 
Working on some engines, working for the fun !

Riptide



Registered
  26/07/2013 21:07:20
Points
  101
12th February, 2014 at 12/02/2014 07:56:31 -

Hi there, youre missing something but what ? Anyways retry that
1. Create a string object called 'string'
2. Set and rename the alterable string A 'playerName' and set your text in it
3. Create a new event

Start of frame:
> 'string':Set alterable text to (''Hello '' + playerName + '', nice to see you again !'')

Hope that helps, cya

 
Working on some engines, working for the fun !

Verdigriss



Registered
  10/02/2014 00:04:44
Points
  5
12th February, 2014 at 12/02/2014 15:26:44 -

Wow, thanks, guys! Working like a charm now. Didn't realize I had to use the expression editor . Thanks for all your patient help!


 
n/a
   

Post Reply



 



Advertisement

Worth A Click