Raised This Month: $ Target: $400
 0% 

warnings: loose indentation and tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tolpecek
Member
Join Date: Dec 2018
Old 12-29-2018 , 12:52   warnings: loose indentation and tag mismatch
Reply With Quote #1

Hello, i have a question. What causes warnings loose indentation and tag mismatch?

Last edited by tolpecek; 12-29-2018 at 12:52.
tolpecek is offline
tolpecek
Member
Join Date: Dec 2018
Old 12-29-2018 , 12:55   Re: warnings: loose indentation and tag mismatch
Reply With Quote #2

Code:
public ScreenFade_Zariche(id)
{
	print_color(id, "Napisal si zariche")
	new players[32], num
	//get_players(players, num, "ace", "CT")
	get_players(players, num);

	new shakeAmplitude = __FixedUnsigned16(SHAKE_AMPLITUDE, 1<<12)
	new shakeDuration  = __FixedUnsigned16(SHAKE_DURATION, 1<<12)
	new shakeFrequency = __FixedUnsigned16(SHAKE_FREQUENCY, 1<<9)

	for(--num; num>=0; num--)
	{
		message_begin(MSG_ONE, gmsgShake, .player = players[num])
			{
				write_short( shakeAmplitude )  // shake amount.
				write_short( shakeDuration )   // shake lasts this long.
				write_short( shakeFrequency )  // shake noise frequency.
			}
		message_end()


		message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, players[num]);
			{
				write_short(4096*10);    // Duration
				write_short(4);    // Hold time 4096*2
				write_short(4096);    // Fade type
				write_byte(0);        // Red
				write_byte(0);        // Green
				write_byte(0);        // Blue
				write_byte(255);    // Alpha
			}
		message_end()       // here it says loose indentation
		}	
	return PLUGIN_HANDLED
}
this do not work at all

Last edited by tolpecek; 12-29-2018 at 12:58.
tolpecek is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2018 , 17:14   Re: warnings: loose indentation and tag mismatch
Reply With Quote #3

Loose indentation is when the indentation of your code is no consistent. This does not affect code execution but it's best if you don't ignore this warning because proper indentation helps make the code more readable and make it easier to find certain mistakes.

Tag mismatch is what is says, it's when two variables used together don't have matching tags. This may or may not affect code execution depending on which tag is mismatched. It usually means that something in the logic of your code is wrong and should be fixed.

P.S. There is no such thing as __FixedUnsigned16() in AMX Mod X so I'm not sure what that is. If you still need help, you need to provide more information i.e. it's best if you attach the whole .sma file to your post and provide the whole compiler output.
__________________

Last edited by fysiks; 12-29-2018 at 17:20.
fysiks is offline
tolpecek
Member
Join Date: Dec 2018
Old 12-29-2018 , 17:22   Re: warnings: loose indentation and tag mismatch
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Loose indentation is when the indentation of your code is no consistent. This does not affect code execution but it's best if you don't ignore this warning because proper indentation helps make the code more readable and make it easier to find certain mistakes.

Tag mismatch is what is says, it's when two variables used together don't have matching tags. This may or may not affect code execution depending on which tag is mismatched. It usually means that something in the logic of your code is wrong and should be fixed.

P.S. There is no such thing as __FixedUnsigned16() in AMX Mod X so I'm not sure what that is. If you still need help, you need to provide more information i.e. it's best if you attach the whole .sma file to your post and provide the whole compiler output.
i do not want to show my plugin, but here is a code of __FixedUnsigned16()
Code:
__FixedUnsigned16(Float:flValue, iScale)
{
	new iOutput;

	iOutput = floatround(flValue * iScale)

	if ( iOutput < 0 )
		iOutput = 0

	if ( iOutput > 0xFFFF )
		iOutput = 0xFFFF
	
	return iOutput
}
tolpecek is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2018 , 20:56   Re: warnings: loose indentation and tag mismatch
Reply With Quote #5

That function seems to be ok. Since you've not posted any more information about the warnings, I can only assume you've fixed everything.
__________________
fysiks is offline
tolpecek
Member
Join Date: Dec 2018
Old 12-30-2018 , 03:33   Re: warnings: loose indentation and tag mismatch
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
That function seems to be ok. Since you've not posted any more information about the warnings, I can only assume you've fixed everything.
it does not work
Code:
#define SHAKE_AMPLITUDE    16.0    // max = 16.0
#define SHAKE_DURATION    6.0        // max = 16.0
#define SHAKE_FREQUENCY    100.0    // max = 256.0
Code:
public ScreenFade_Zariche(id)
{
	new players[32], num
	//get_players(players, num, "ace", "CT")
	get_players(players, num);

	new shakeAmplitude = __FixedUnsigned16(SHAKE_AMPLITUDE, 1<<12)
	new shakeDuration  = __FixedUnsigned16(SHAKE_DURATION, 1<<12)
	new shakeFrequency = __FixedUnsigned16(SHAKE_FREQUENCY, 1<<9)

	for(--num; num>=0; num--)
	{
		message_begin(MSG_ONE, gmsgShake, .player = players[num])
			{
				write_short( shakeAmplitude )  // shake amount.
				write_short( shakeDuration )   // shake lasts this long.
				write_short( shakeFrequency )  // shake noise frequency.
			}
		message_end()


		message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, players[num]);
			{
				write_short(4096*10);    // Duration
				write_short(4);    // Hold time 4096*2
				write_short(4096);    // Fade type
				write_byte(0);        // Red
				write_byte(0);        // Green
				write_byte(0);        // Blue
				write_byte(255);    // Alpha
			}
		message_end()
		}	
	return PLUGIN_HANDLED
}
Code:

tolpecek is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-30-2018 , 17:40   Re: warnings: loose indentation and tag mismatch
Reply With Quote #7

The topic is about loose indentation and a tag warning. Did you fix those? If no, you need to provide more information. If yes, you should start a new thread inquiring about your new topic. However, make sure you make a serious effort to debug your code on your own.
__________________
fysiks is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 12-31-2018 , 12:27   Re: warnings: loose indentation and tag mismatch
Reply With Quote #8

for(--num; num>=0; num--) lol, what is this?
->
for(new i; i < num; i++)
Remove the brackets of message_begin and make all write_* at the same level as message_begin. The second bracket of the for() is bad.
That code looks really bad.
__________________

Last edited by eat1k; 12-31-2018 at 12:28.
eat1k is offline
tolpecek
Member
Join Date: Dec 2018
Old 12-31-2018 , 20:55   Re: warnings: loose indentation and tag mismatch
Reply With Quote #9

Quote:
Originally Posted by eat1k View Post
for(--num; num>=0; num--) lol, what is this?
->
for(new i; i < num; i++)
Remove the brackets of message_begin and make all write_* at the same level as message_begin. The second bracket of the for() is bad.
That code looks really bad.

Still doesn´t work..
//edit, it crashes server : L 01/01/2019 - 03:05:57: (map "") Host_Error: WriteDest_Parm: not a client

Last edited by tolpecek; 12-31-2018 at 21:20.
tolpecek is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-31-2018 , 21:02   Re: warnings: loose indentation and tag mismatch
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
The topic is about loose indentation and a tag warning. Did you fix those? If no, you need to provide more information. If yes, you should start a new thread inquiring about your new topic. However, make sure you make a serious effort to debug your code on your own.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode