Sign in to follow this  
Followers 0
atrX

Find the Error

45 posts in this topic

Bear almost got it :O

 

Remember this wouldn't cause a script error to pop up, the script just wouldn't work how it was meant to be. So put sentrex and one of bear answer together and you might get the answer :O

0

Share this post


Link to post
Share on other sites

the script just wouldn't work how it was meant to be

if( level.ee_step6_souls >= level.ee_step6_soul_c )
{
        level.ee_step6_active = false;
        flag_set( "ee_step6" );
}

is never reached because a value cant be < and >= at the same time (the ++ is too late in the script or the initial if statement should be <=)

if( isDefined( how_the_fuck_this_script_is_MEANT_work ) )
	return ":okay:";
else
	return ":angryarnold:";
Edited by Bear
0

Share this post


Link to post
Share on other sites

I agree with bear, (fek u bear, beat meh to it :c)

 

if( level.ee_step6_souls >= level.ee_step6_soul_c )
{
        level.ee_step6_active = false;
        flag_set( "ee_step6" );
}

 

this will never happen, even if the thread is activated again...

 

level.ee_step6_souls < level.ee_step6_soul_c )    <-- is required for the statement to work

 

if( level.ee_step6_souls >= level.ee_step6_soul_c )
{
        level.ee_step6_active = false;
        flag_set( "ee_step6" );
}

 

^ that is only achievable when souls is greater or equal to soul c, so it didn't execute that statement BUT... at the end is says souls++; when the souls is = to soul c is then can do the 2nd statement, but soul needs to be lower than soul c to get passed through the first statement..

 

MY wording was probably very bad but meh xD

0

Share this post


Link to post
Share on other sites

I literally said that exact same thing.. Go look at my first post :angryarnold:

0

Share this post


Link to post
Share on other sites

I literally said that exact same thing.. Go look at my first post :angryarnold:

i think it was due to you saying, nothing happens after the 2nd statement. That's to say if the solution bear posted was correct; fairly certain it is. If it is the case you or bear should be able to post a new problem :troll:

0

Share this post


Link to post
Share on other sites

i think it was due to you saying, nothing happens after the 2nd statement. That's to say if the solution bear posted was correct; fairly certain it is. If it is the case you or bear should be able to post a new problem :troll:

Just reread my answer :okay: I'm not the best at explaining things but that's what I meant in general, ty to you and bear for clearing it up :dumb:

If its even right :horror:

0

Share this post


Link to post
Share on other sites

Before:

step6_death_watch()
{
	time = 5;

	self waittill( "death" );

	if( isDefined( level.ee_step6_active ) && level.ee_step6_active && self isTouching( level.ee_step6_radius ) && level.ee_step6_souls < level.ee_step6_soul_c )
	{
		org = spawn( "script_origin", self.origin );
		tag = spawn( "script_model", self.origin );
		tag setModel( "tag_origin" );
		tag enableLinkTo();
		tag linkTo( org );
		tag thread step6_fx( time );

		org moveTo( level.ee_step6_fx_goto.origin, time );
		org waittill( "movedone" );

		if( level.ee_step6_souls >= level.ee_step6_soul_c )
		{
			level.ee_step6_active = false;
			flag_set( "ee_step6" );
		}

		wait 8;

		tag delete();
		org delete();

		level.ee_step6_souls++;
	}
}

After:

step6_death_watch()
{
	time = 5;

	self waittill( "death" );

	if( isDefined( level.ee_step6_active ) && level.ee_step6_active && self isTouching( level.ee_step6_radius ) && level.ee_step6_souls < level.ee_step6_soul_c )
	{
		org = spawn( "script_origin", self.origin );
		tag = spawn( "script_model", self.origin );
		tag setModel( "tag_origin" );
		tag enableLinkTo();
		tag linkTo( org );
		tag thread step6_fx( time );

		org moveTo( level.ee_step6_fx_goto.origin, time );
		org waittill( "movedone" );

		wait 8;

		tag delete();
		org delete();

		level.ee_step6_souls++;

		if( level.ee_step6_souls >= level.ee_step6_soul_c )
		{
			level.ee_step6_active = false;
			flag_set( "ee_step6" );
		}
	}
}

GG guys. :)

0

Share this post


Link to post
Share on other sites

WHAT THE HELL, THAT'S THE SHITTEST THING. YOU LITERALLY MOVED IT UP LOL

 

 

 

you sly motherfucker, i thought it was harder

0

Share this post


Link to post
Share on other sites

WHAT THE HELL, THAT'S THE SHITTEST THING. YOU LITERALLY MOVED IT UP LOL

 

 

 

you sly motherfucker, i thought it was harder

Yep, it would never execute the code in the if statement because of its place. :dumb:

0

Share this post


Link to post
Share on other sites

Yep, it would never execute the code in the if statement because of its place. :dumb:

I said that it wouldnt do anything under the if statement because of this :okay:

0

Share this post


Link to post
Share on other sites

I said that it wouldnt do anything under the if statement because of this :okay:

Point is to fix it. :dave: Just saying it wouldn't do anything doesn't fix the script.

0

Share this post


Link to post
Share on other sites

Point is to fix it. :dave: Just saying it wouldn't do anything doesn't fix the script.

Well.. I would say the point is to 'Find The Error' but okay cool

0

Share this post


Link to post
Share on other sites

The one time I doubt myself about the error and it turns out to be the actual error. I was thinking that the tag delete(); and the org delete(); had to be moved on the first day the post was made :okay:

0

Share this post


Link to post
Share on other sites

*Major Bump*

 

So in both of these pieces of code were both made in python. Yes they're are very random and something quick that I could come up with.

 

The first one has three bugs in it:

 

#Season finder with 3 bugs




#input the moth of the year and the program


#will tell you which season it is in




month = input("Enter the month of year: ")


month = Month.title()




if month == "December" or month = "January" or month == "February":


    print(month,"is in Winter")


elif month == "March" or month == "April" or month == "May":


    print(month,"is in Spring")


elif month == "June" or month == "July" or month == "August":


    print(month,"is in Summer")


elif month == "September" or month == "October" or month == "November":


    Print(month,"is in Autumn")


else:


    print("Check spelling of the month.")


   
input("Press ENTER to quit")
 
 
 
 
 
 
 
The second one has five bugs in it:
 
 
 
#Tax Calculator with 5 bugs




salary = int(input("Please enter your annual salary: £")))






if salary < 30000


#Salaries under 30000 are taxed at 20%


    tax = salary * 0.2


elif salary >= 30000:


#Salaries over 30000 are taxed at 40% for anything over 30000


    salary = salary - 30000


tax = salary * 0.4 + 6000


else:


#Salaries over 150000 are taxed at 45% for anything over 150000


    salary = salary - 150000


    tax = salary * 0.45 + 6400 + 48000


   
print("Earnings of £",salray,"will attract taxes of £",round(tax,2))


input("Press ENTER to quit")​

 

 

 

There both completely random things.

Edited by Mo:)
Put in code tags
0

Share this post


Link to post
Share on other sites

#1:

month = input( "Enter the month of year: " )
month = month.title() # Month -> month

if month == "December" or month == "January" or month == "February": # month = "January" -> month == "January"
	print( month, "is in Winter" )

elif month == "March" or month == "April" or month == "May":
	print( month, "is in Spring" )

elif month == "June" or month == "July" or month == "August":
	print( month, "is in Summer" )

elif month == "September" or month == "October" or month == "November":
	print( month, "is in Autumn" ) # Print() -> print()

else:
	print( "Check spelling of the month." )

input( "Press ENTER to quit" )

#2:

salary = int( input( "Please enter your annual salary: £" ) )

if salary < 30000: # added colon - 1
	tax = salary * 0.2

elif salary <= 150000: # >= 30000 is a useless check, changed to <= 150000 for other condition - 2
	salary -= 30000 # changed operator, cleaner code, not an actual problem
	tax = salary * 0.4 + 6000 # fixed mandatory indentation for python syntax - 3

else:
	salary -= 150000
	tax = salary * 0.45 + 6400 + 48000

print( "Earnings of £", salary, "will attract taxes of £", round( tax, 2 ) ) # fixed spelling for salary variable - 4

input( "Press ENTER to quit" )

Don't know where you count 6 errors but whatevs. :P Runs fine:

0EZSWsC.png

 


 

New one:

toFloat( in ) {
	// Don't accept arrays or undefined, return 0
	if( isArray( in ) || !isDefined( in ) )
		return 0;

	// Return original argument, it's not a string so doesn't need any special type conversion algorithm
	if( !isString( in ) )
		return in;

	num = strTok( in, "." ); // Split string into 2 seperate strings

	// Don't need to execute extra logic if the number isn't a decimal and therefore wasn't split into a multi-element array
	if( num.size <= 1 )
		return int( num[0] );

	pwr = 10;
	// Multiply by 10 for each extra character
	for( i = 0; i < num[1].size; i++ )
		pwr *= 10;

	return int( num[0] ) + int( num[1] ) / pwr;
}

Won't throw an error, there's just a tiny flaw in the logic behind it.

0

Share this post


Link to post
Share on other sites

For some reason Slaya, 

salary = int(input( "Please enter your annual salary: £"))

Is already fixed. It was originally...

salary = int(input( "Please enter your annual salary: £")))

That should have been your first issue. But my apologies there was only five problems.

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0