ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperCube > Programming and Scripting
dialogue - get lines of text from text file
Author Text

Registered User
2017-08-10 22:42:20

I need to get help to understand how to load specific lines of dialouge from a text file. (and remember that I am a total javascript noob!).
Yes, I've managed to load text from a file and show the whole text.
BUT, I need to be able to choose specific lines.

I could be satisfied for now with something easy, like this nr 1 example below. Or a more sophisticated version, see nr 2, below.

Lets say the dialogue file looks something like this (but say it has 300 lines instead of 4, as below):

Player: Excuse me, do you know the way to Simsilam
Wizard: Oh yes, it's that way
Player: Are you sure?
Wizard: I'll show you

Lets assume I only need line 3 "Are you sure?" to show up in a 2D dialogue box. And then the following line 4 in another 2D box - how to do this in a simple but usable way?

I scanned the forum and found a really old entry from 2011. It seems to me that the text could be divided up with this example, but it gets me nowhere as I am not at programmer:

Ideally, I would like to have something where you can choose answers and depending on your choice, you get a specific answer, like this:

"Hi! Welcome to Coppercube! Is this your first visit?",
1 "Yes, I just arrived"
2 "No, I've been here before"

So, if you choose nr 2 you get:
"Ok, cool, what have you learned so far?!"
Or, if you select nr 1:
"Interesting! How did you get here?"


This javascript found on Github does these thigs, which would be awesome to have, perhaps it could be made into a behaviour for Coppercube?

I was not able to install it via the windows command "DOS" window (it gives me errors)
But the documentation sure on Github looks promising.
If anybody feels like making this thing usable and more user friendly for CC, (or something similar) I would be much delighted!

Also, i found this, which is interesting, but still I am not a programmer, so this is really a jungle for me to resolve:

Registered User
2017-08-12 11:59:51

I propose to use reference numbers for the dialog conversation and you go directly through the line.

I would advise to split all dialog into smaller files as well

then you target reading the file as a text file by going to the line number and the correct filename.

Registered User
2017-08-16 21:57:49

Yes, something like that - could somebody provide a few lines of code to show a working example in how to get a specific line of text from a external text file?

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inter?ational" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Software: Ambiera Light Forum. © 2008-2015 Nikolaus Gebhardt, Ambiera e.U.