on mouse click, create box with text from file

Get help using Construct 2

Post » Fri Jun 14, 2013 1:59 am

Hi all! Been awhile!

I want to know if it is possible to do something like this:

On mouse click on an object
- a text box pops up
- in that text box, it reads from a specific portion of a given text file. let's use a txt file of the first four lines of The Wasteland (copy and paste into notepad or something):

April is the cruellest month, breeding
Lilacs out of the dead land, mixing
Memory and desire, stirring
Dull roots with spring rain.

So there would be four objects/sprites, and on click, each one would call from the wasteland.txt file, a specific line from the poem and only that specific line.

Could someone help me out with a description of how this could be done or a capx?

Thank you!

Ys!
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Sun Jun 16, 2013 8:11 am

b...bump? :(
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Sun Jun 16, 2013 8:44 am

Sorry, is this what you want?
1. You want a four or more line of poem in a text file
2. Then spawn four or more sprite each related to that specific line of poem.
3. If the sprite is clicked, a textbox would be updated with the line associated with the sprite?

Edit: Something like this?
https://dl.dropboxusercontent.com/u/55358831/helping/poem_sprite.capxlunarray2013-06-16 08:54:14
B
36
S
6
G
2
Posts: 190
Reputation: 4,223

Post » Mon Jun 17, 2013 2:35 am

omg! YES!

I don't really understand how it works. Would you be able to comment that capx or leave another reply.

example: I'm guessing wasteland.txt was in the project folder before being exported or saved as a single capx file?

i'm trying to do something like this. where if the player clicks on the teapot it says one thing from the txt file (say, line 1) and if the player clicks on the plates underneath it says another (line 2). I can make invisible sprites for this.



omg. you're the best.
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Mon Jun 17, 2013 4:56 am

I updated the capx with comments. But you might want to ignore that and check the one below...

Now that I understand what you are trying to make, I guess that capx is not very useful in this case. I make another one which is more straightforward and easy.

https://dl.dropboxusercontent.com/u/55358831/helping/click_info.capx

This one is sure easier to make and you can edit it in C2 instead of having to dwell with a text file. (it only has one event)

You just need to set a instance variable to the hotspot sprite to any text you wanted...
B
36
S
6
G
2
Posts: 190
Reputation: 4,223

Post » Mon Jun 17, 2013 5:20 am

Thank you for both! Yes you are right it is easier to make in C2, but the problem is the text I'm working with is extremely long : Tender Buttons by Gertrude Stein - so for example, a carafe, her first poem, is 3 paragraphs).

http://www.gutenberg.org/files/15396/15396-h/15396-h.htm

That's why i was wondering if having a text file of the poems would have been easier, since i could just call a line, instead of having to have the whole poem be put in to c2 as a variable or a text object or whatever
B
16
S
3
G
3
Posts: 66
Reputation: 3,629


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests