Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Flag not Executitng
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Hack.saw




PostPosted: Sun Jan 21, 2007 6:58 pm   Post subject: Flag not Executitng

code:
if AttackCD > 0 and combat = true and Dead = false then%.................cool down on attacks (you)
           AttackCD -= 1
           
        elsif AttackCD = 0 and combat = true and Dead = false then%..............sets attack speed (you)
            AttackCD := round (WeaponSpeed*100)
        end if


WeaponSpeed is set to which weapon you are currently using. If you are using a fast weapon (ie. speed of 1.9 or <) this code works perfectly and you attack everytime AttackCD = your cooldown. My problem, and I have no clue why, is if you are using a weapon with a speed > then 1.9 the CD still works and counts down to 0 then resets but you never attack when it = your cooldown Confused

my code to attack is:
code:
if target (1) > 0 and combat = true and EnemyY >= PlayerY+35 and EnemyX >= PlayerX +35 and autoattack = true and AttackCD = (WeaponSpeed*100) or target (1) > 0 and combat = true and EnemyY <= PlayerY+35 and EnemyX <= PlayerX +35 and autoattack = true and AttackCD = (WeaponSpeed*100) or target (1) > 0 and combat = true and autoattack=true and EnemyY <= PlayerY+35 and EnemyX >= PlayerX +35 and AttackCD = (WeaponSpeed*100) or target (1) > 0 and combat = true and autoattack=true and EnemyY >= PlayerY+35 and EnemyX <= PlayerX +35 and AttackCD = (WeaponSpeed*100) then

If you want full code please ask, I can't figure it out, with fast weapons it goes through everything and attacks but with slow weapons it goes through everything but doesn't attack Crying or Very sad
Sponsor
Sponsor
Sponsor
sponsor
Hack.saw




PostPosted: Sun Jan 21, 2007 8:19 pm   Post subject: Re: Flag not Executing

Cervantes, Robert, anyone? It doesnt make any sense to me and I'm handing this in tomorow =/ Sorry if Im being a little impatient but this is a redicules bug and just comes up before I'm almost completely done my game Sad Anyone have questions for me that might help pinpoint the problem or ever had anything like this happen before? The conditions of the if are being met and theres not contradicitng code...
ericfourfour




PostPosted: Mon Jan 22, 2007 3:44 pm   Post subject: Re: Flag not Executing

Hack.saw @ Sun Jan 21, 2007 8:19 pm wrote:
I'm handing this in tomorow

Its a good thing no one helped you. I guess you learned your lesson on leaving things to the last minute.


Hack.saw wrote:
my code to attack is:
code:
if target (1) > 0 and combat = true and EnemyY >= PlayerY+35 and EnemyX >= PlayerX +35 and autoattack = true and AttackCD = (WeaponSpeed*100) or target (1) > 0 and combat = true and EnemyY <= PlayerY+35 and EnemyX <= PlayerX +35 and autoattack = true and AttackCD = (WeaponSpeed*100) or target (1) > 0 and combat = true and autoattack=true and EnemyY <= PlayerY+35 and EnemyX >= PlayerX +35 and AttackCD = (WeaponSpeed*100) or target (1) > 0 and combat = true and autoattack=true and EnemyY >= PlayerY+35 and EnemyX <= PlayerX +35 and AttackCD = (WeaponSpeed*100) then

This is a massive amount of code for a single if statement. You should try breaking it into separate functions for more readability. Also, instead of writing:

Turing:
if autoattack = true then

or

if autoattack = false then


write:

Turing:
if autoattack then

or

if not autoattack then
Hack.saw




PostPosted: Mon Jan 22, 2007 6:55 pm   Post subject: Re: Flag not Executitng

Claping Wow...way to be a prick. Claping I didn't leave it to the last minute, I had a couple hours to myself and decided I wanted to improve upon what I had for my game. Added a few weps and some more options then the bug popped up which is why I was so mad about it. Sorry if going the extra little bit to improve something is foriegn to you, but yeah its a concept you should pick up on.
Anyway, Figured out my bug I was rounding the speed it set it to but forgot to round it when i checked for it which ment some of the bigger numbers I added were being rounded up to high. As of your last suggestion I did not even know that "not" was a command in turing, I think I'll just continue on the way I know and was taught. As of the big if statement, if I had to make 4 different statments it would be alot of code I don't need.
CodeMonkey2000




PostPosted: Tue Jan 23, 2007 4:54 pm   Post subject: RE:Flag not Executitng

Hack.saw, That is flaming, Ericourfour has much more experience with programming and is more knoledgeable than you. This is not how you thank someone for taking the time to help you.
ericfourfour




PostPosted: Tue Jan 23, 2007 7:56 pm   Post subject: Re: Flag not Executitng

Hack.saw @ Mon Jan 22, 2007 6:55 pm wrote:
Claping Wow...way to be a prick. Claping I didn't leave it to the last minute, I had a couple hours to myself and decided I wanted to improve upon what I had for my game.

Sorry Hack.saw, I never thought of that (you just seemed a little desperate with your double post).


Hack.saw @ Mon Jan 22, 2007 6:55 pm wrote:
I did not even know that "not" was a command in turing, I think I'll just continue on the way I know and was taught. As of the big if statement, if I had to make 4 different statments it would be alot of code I don't need.

This is just a bit of advice: if you practise programming with a closed mind (ie not willing to try new things such as not or functions), it will be very difficult to get better and succeed. If you are not willing to accept criticism from others, then why ask for help?
Hack.saw




PostPosted: Tue Jan 23, 2007 10:55 pm   Post subject: Re: RE:Flag not Executitng

spearmonkey2000 @ Tue Jan 23, 2007 4:54 pm wrote:
Hack.saw, That is flaming, Ericourfour has much more experience with programming and is more knoledgeable than you. This is not how you thank someone for taking the time to help you.

He didnt really help me...
Quote:
Its a good thing no one helped you. I guess you learned your lesson on leaving things to the last minute

^was the line I was talking about.^
Quote:
you just seemed a little desperate with your double post

Hehe, I was very desperate and angry at the time. Believe me I started this game a good week before we stared our project along with another game but I decided this one was more complex and would be worth more. To have a bug like that pop up 2 hours before I had to go to bed then in the morning hand it in was deffinatley not fun.
Quote:
This is just a bit of advice: if you practise programming with a closed mind (ie not willing to try new things such as not or functions), it will be very difficult to get better and succeed. If you are not willing to accept criticism from others, then why ask for help?

Didn't say at all I wasn't accepting critism, nor did I mention that the code you put was most likely better than what I use. I was taught to use booleans with if true or false and just tpye things by habbit. Keep in mind I have switched from (x:=x+1) to (x+=1) along with many other things from this site and probably would and will use that in the future. You have to understand that someone saying, Im glad you didnt get help, didnt exaclty make me feel any better when reading what I thought was someone trying to help fix the problem though...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: