The Daily Click ::. Forums ::. Klik Coding Help ::. Anyway to do this to a string object?
 

Post Reply  Post Oekaki 
 

Posted By Message

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
9th January, 2006 at 19:14:51 -

Okay, now I know you can set text values to a string's paragraphs at design time no problem, but at run time it seems to me that you can't.

This is what I'm trying to do:

Have a counter choose a random # from 1-10, say.
If cnt(#) = 1 then change string(paragraph1) to "Hello" ; change string(paragraph2) to "What's up?"
If cnt(#) = 2 then change string(paragraph1) to "Howdy!"; change string(paragraph2) to "Nice to see you!"
(etc. up to 10)

Okay, now obviously these string texts are crap and will be filled with better stuff, but what I'd like to have is every time the guy walks into a store he can carry on a different opening conversation with the storeowner. It'd be a lot better than the same conversation over and over again, which is what I have now. So basically I'm looking for a way to change the string's paragraph texts at run time. It seems all I can do is change the "alterable string", which is not what I'd like to do and doesn't work aside from changing everything to the same text.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
9th January, 2006 at 21:11:12 -

The only part of the string object that can be altered at runtime is the alterable string, which is what you've found. If you need to change a whole bank of them at once, consider having separate text objects, each one with a possible conversation, and another that is actually displayed on the screen. The alterable string of that string object could then be changed to match the paragraph of the randomly selected (as Phizzy mentioned) string object.

 
http://www.davidn.co.nr - Games, music, living in America

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
10th January, 2006 at 20:06:56 -

Cool, thanks for the help.

As it is now, what happens is there is a sort of "back n' forth" method to the conversations, where one person gets to say a line, and then the other, then back again. This is all done in one big string but it has it's limitations.

I'll make sure to incorporate a better system for conversations next time.


 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!
   

Post Reply



 



Advertisement

Worth A Click