Button Detection Bug
#1

The core of my problem is that inside of the lines (right bottom), every click triggers button one, so button two basically does not work.
(http://kephost.com/images/2016/01/23/Nevtelen2df7b.png)
(https://www.youtube.com/watch?v=kJ0beS_TuhI)



Код:
        PipBoy[playerid][95] = CreatePlayerTextDraw(playerid,205.000000, 171.000000, "button");
	PlayerTextDrawAlignment(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawBackgroundColor(playerid,PipBoy[playerid][95], 255);
	PlayerTextDrawFont(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawLetterSize(playerid,PipBoy[playerid][95], 0.210000, 0.799999);
	PlayerTextDrawColor(playerid,PipBoy[playerid][95], 803946495);
	PlayerTextDrawSetOutline(playerid,PipBoy[playerid][95], 0);
	PlayerTextDrawSetProportional(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawSetShadow(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawSetSelectable(playerid,PipBoy[playerid][95], 1);

	PipBoy[playerid][96] = CreatePlayerTextDraw(playerid,205.000000, 178.000000, "button2");
	PlayerTextDrawAlignment(playerid,PipBoy[playerid][96], 1);
	PlayerTextDrawBackgroundColor(playerid,PipBoy[playerid][96], 255);
	PlayerTextDrawFont(playerid,PipBoy[playerid][96], 1);
	PlayerTextDrawLetterSize(playerid,PipBoy[playerid][96], 0.210000, 0.799999);
	PlayerTextDrawColor(playerid,PipBoy[playerid][96], 803946495);
	PlayerTextDrawSetOutline(playerid,PipBoy[playerid][96], 0);
	PlayerTextDrawSetProportional(playerid,PipBoy[playerid][96], 1);
	PlayerTextDrawSetShadow(playerid,PipBoy[playerid][96], 1);
	PlayerTextDrawSetSelectable(playerid,PipBoy[playerid][96], 1);
Reply
#2

It's not actually a bug. This is happening because clickable (or selectable) areas of textdraws are too big. Take a look at this function: PlayerTextDrawTextSize. Set different values for x and y parameters and try to understand how it works.
And its really difficult to create fancy textdraws without any tool, so I would suggest you to use filterscripts such as TDEditor 1.16 - New TextDraw creator with Preview models - 0.3.7.
Reply
#3

Required to use this function box?
Can you help me with an example? I use this textdraw:

Код:
        PipBoy[playerid][95] = CreatePlayerTextDraw(playerid,205.000000, 171.000000, "button");
	PlayerTextDrawAlignment(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawBackgroundColor(playerid,PipBoy[playerid][95], 255);
	PlayerTextDrawFont(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawLetterSize(playerid,PipBoy[playerid][95], 0.210000, 0.799999);
	PlayerTextDrawColor(playerid,PipBoy[playerid][95], 803946495);
	PlayerTextDrawSetOutline(playerid,PipBoy[playerid][95], 0);
	PlayerTextDrawSetProportional(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawSetShadow(playerid,PipBoy[playerid][95], 1);
	PlayerTextDrawSetSelectable(playerid,PipBoy[playerid][95], 1);
Reply
#4

bump, please
Reply
#5

I'm not really experienced in this function and I had some problems, before I started to use TDEditor.
Lets start from some big values (x = 200, y = 200). Then try to lower them by 20 for example, and see what will be changed. Here is the code:
PHP код:
    PipBoy[playerid][95] = CreatePlayerTextDraw(playerid,205.000000171.000000"button");
    
PlayerTextDrawAlignment(playerid,PipBoy[playerid][95], 1);
    
PlayerTextDrawBackgroundColor(playerid,PipBoy[playerid][95], 255);
    
PlayerTextDrawFont(playerid,PipBoy[playerid][95], 1);
    
PlayerTextDrawLetterSize(playerid,PipBoy[playerid][95], 0.2100000.799999);
    
PlayerTextDrawTextSize(playeridPipBoy[playerid][95], 200.0200.0); // <--- this line. Each time you test your textdraw, subtract 20 from those values.
    
PlayerTextDrawColor(playerid,PipBoy[playerid][95], 803946495);
    
PlayerTextDrawSetOutline(playerid,PipBoy[playerid][95], 0);
    
PlayerTextDrawSetProportional(playerid,PipBoy[playerid][95], 1);
    
PlayerTextDrawSetShadow(playerid,PipBoy[playerid][95], 1);
    
PlayerTextDrawSetSelectable(playerid,PipBoy[playerid][95], 1); 
Reply
#6

Thanks mate!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)