Jump to content

[LUA] Character ; not appearing in dialog choice


Recommended Posts

I've noticed this one since the beginning but for some reason I've been waiting until now to ask.

Let's say I'm writing a dialog with NPC X and when I click on it I want it to say:

    Hi, how are you today;

So I'm writing the classic when XXXXXX.chat."Hi, how are you today;and I'm compiling but when I click in the game the ; is missing! So it just says:

    Hi, how are you today

I haven't yet find what filters the character so I'm asking you. I've looked in questlua.cpp and questlua_global.cpp but didn't find anything.

If anyone knows I'm also trying to find a way to increase the dialog width (after a line ends, there is just soooo much right padding!)

Link to comment
Share on other sites

  • Developer

Probably the client sniffing around. That exact character (along with brackets and vertical bar) is used for parsing quests' strings sent by the server. At this point, you may have noticed that the client doesn't only receives whatever text a quest has, but also an event type bound to that said text, being it formatting, window resizing, image preview, etc. 
Those actions are read this way.

This is what the server will send to the client, using the example you provided above:

[QUESTION resume;0|1;Hi, how are you today;|2;Close]

resume stands for, eh.. a suspended state, can be said iirc. Meaning that it requires the player to answer. Everything else are necessary data the binary will send to the python-side of your client in order to create the so well known: chat-event. In order words, the buttons.

My suggestion is to jump into your PythonEventManager class for further info. The parser is in EterLib/parser.*


 

when you return 0 and server doesn't boot:

unknown.png

Link to comment
Share on other sites

17 minutes ago, PACI said:

Probably the client sniffing around. That exact character (along with brackets and vertical bar) is used for parsing quests' strings sent by the server. At this point, you may have noticed that the client doesn't only receives whatever text a quest window has, but also an event type bound to that said text, being it formatting, window resizing, item previews and whatnot. 
Those actions are read this way.

This is what the server will send to the client, using the example you provided above:


[QUESTION resume;0|1;Hi, how are you today;|2;Close]

resume stands for, eh.. a suspended state, can be said I guess. Meaning that it requires the player to answer. Everything else are necessary data the binary will send to the python-side of your client in order to create the so well known: chat-event. In order words, the buttons.

My suggestion is to jump into your PythonEventManager class for further info. The parser is in EterLib/parser.*


 

Thank you so much for your reply. I searched in the files you mentioned and I found the check that handles this character in parser.cpp

else if (c == ';')
{
	isValue = true;
}

I tried changing this to false but the result was not what I expected... I do not understand the most out of the code yet so I have to ask for a simple example. I thought maybe sending signal-character will do the trick. For example, I send ^ and write another check in this function that replaces

^[SPACE][END-OF-LINE]

with the character. The only problem is that I don't know how to edit the string's characters so I'm gonna have to request an example.

Again, thank you so much for the reply, it really helped a lot.

Link to comment
Share on other sites

  • Active+ Member
// uiQuest.py
	def AppendQuestion(self, name, idx):
		if not self.btnAnswer:
			return
			
		# This if:
		if name.find("#SC#") != -1:
			name = name.replace("#SC#", ";")

In your quest just use #SC#.

Hardcoded but is just a if ...

  • Sad 1
Link to comment
Share on other sites

On 1/4/2019 at 1:29 PM, hachiwari said:

You can change separator to own, e.g. '#' in 

1) game/questlua.cpp -> os << i << ";" << lua_tostring(qs.co,-1);

2) client/EterLib/parser.cpp -> else if (c == ';')

or edit this function in parser.cpp

Btw. But for what?xD What do you want to do?

 

Thanks I will try the 1st solution, seems legit. I want to do it because in greek ';' = '?'

EDIT: So I changed it in questlua.cpp and parser.cpp but the font became black, no syserr, so I went with the Python solution and it pretty mych worked out. Thanks @Abel(Tiger), thanks to all of you who responded :)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.