YSI-Includes icon indicating copy to clipboard operation
YSI-Includes copied to clipboard

[y_text] undefined symbol "Dialog_ObtainID"

Open vincenzocorso opened this issue 6 years ago • 5 comments

#include <a_samp>

#include <YSI\y_text>
#include <YSI\y_languages>
#include <YSI\y_colors>
#include <YSI\y_inline>
#include <YSI\y_dialog>

main() {}

loadtext mode_text[all];

public OnGameModeInit()
{
	Langs_Add("EN", "English");

	return 1;
}

public OnPlayerConnect(playerid)
{
	inline OnRegisterDialog(pid, dialogid, response, listitem, string:inputtext[])
	{
		printf("OnRegisterDialog called: %d %d %d %d %s", pid, dialogid, response, listitem, inputtext);
		
		return 1;
	}

	Text_PasswordBox(playerid, using inline OnRegisterDialog, $DIALOG_REGISTER_CAPTION, $DIALOG_REGISTER_TEXT, $DIALOGS_OK, $DIALOGS_CANCEL);

	return 1;
}

When I compile this code with sampctl, there are these errors:

...\test\dependencies\YSI-Includes\YSI_Players\y_text\impl.inc:1855 (error) undefined symbol "Dialog_ObtainID"
...\test\dependencies\YSI-Includes\YSI_Players\y_text\impl.inc:2212 (error) undefined symbol "Dialog_SetCallbackData"
...\test\dependencies\YSI-Includes\YSI_Players\y_text\impl.inc:2214 (error) undefined symbol "Dialog_Garbage"

vincenzocorso avatar Sep 20 '18 20:09 vincenzocorso

I solved. It works until commit pawn-lang/YSI-Includes@124840dd79b099b705d093eee00ba3cc1afba760 This issue is present from pawn-lang/YSI-Includes@d35c57efb0f3ac90cdf1dab48465a151fec293d1

vincenzocorso avatar Sep 21 '18 11:09 vincenzocorso

It affects 5.x as well.

https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Players/y_text/y_text_impl.inc#L1132 I thought just removing the explicit id fetch would help, but it turns out there's a slight twist to it: https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Players/y_text/y_text_impl.inc#L1234

This function no longer exists. https://github.com/pawn-lang/YSI-Includes/commit/25f6f7d769a4ed299f979a2363a0e59c4550261e - My idea was to just remove that and change all previous Dialog_Show into Dialog_ShowCallback - but I don't remember if you can pass callback: like that so I used Dialog_ShowCallbackData which is deprecated in 5.x with new Func:. Not tested, but I suppose it should not break anything (unless #emit stuff underneath uses number of local-ish vars somehow).

Misiur avatar Sep 21 '18 14:09 Misiur

Does anyone know why Y_Less changed so much y_dialog code in https://github.com/pawn-lang/YSI-Includes/commit/d35c57efb0f3ac90cdf1dab48465a151fec293d1? What's the point exactly? If I'm not wrong it was working correctly.

I'm trying to figure out how to fix this bug.

Vasily-X avatar Feb 23 '19 16:02 Vasily-X

I realised the way I was doing it before was stupid. You don't need IDs at all - just remember which dialog is open. The old code generated a unique ID for each dialog, which meant keeping track of all in-use and valid IDs. That was a lot of pointless effort. So I just deleted all the code.

What do you need the function for? Maybe there's another way to do this.

Y-Less avatar Feb 23 '19 19:02 Y-Less

I don't need the function at all, thing is this new code generates an error when using dialogs with y_text.

Vasily-X avatar Feb 23 '19 19:02 Vasily-X