You are viewing our Forum Archives. To view or take place in current topics click here.
JAVASCRIPT HELP [READ]
Posted:

JAVASCRIPT HELP [READ]Posted:

YT_ReVoLuTiOnZ
  • V5 Launch
Status: Offline
Joined: Mar 07, 20159Year Member
Posts: 353
Reputation Power: 13
Status: Offline
Joined: Mar 07, 20159Year Member
Posts: 353
Reputation Power: 13
So I have a program im writing for school and im just stuck now. Once I get to the "if statement" thats when I mess up. If someone could help I would really appreciate it. (BTW its only a very simple program not much complexity at all and notice that im no where near done so I kinda just stopped mid progress, read the bottom if you want to know what im trying to do)

-------------------------------------------------------------------------------------
My project so far

[ Register or Signin to view external links. ]

-------------------------------------------------------------------------------------
What im trying to do my project on

[ Register or Signin to view external links. ]


Last edited by YT_ReVoLuTiOnZ ; edited 1 time in total
#2. Posted:
Boston-Bruins
  • V5 Launch
Status: Offline
Joined: May 14, 201013Year Member
Posts: 2,645
Reputation Power: 123
Status: Offline
Joined: May 14, 201013Year Member
Posts: 2,645
Reputation Power: 123
Sorry, this content isn't available right now.
#3. Posted:
-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
You have privacy settings on your Facebook images.
Just take a screenshot of it and upload it to imgur or something.

Just as a heads up, most people here won't do it for you, but give you guidance. If you came here for the whole answer, you will be disappointed.
#4. Posted:
RS
  • Gold Gifter
Status: Offline
Joined: Jul 18, 201013Year Member
Posts: 3,255
Reputation Power: 8239
Status: Offline
Joined: Jul 18, 201013Year Member
Posts: 3,255
Reputation Power: 8239
Links are not working. *5mic5*
#5. Posted:
YT_ReVoLuTiOnZ
  • Ladder Climber
Status: Offline
Joined: Mar 07, 20159Year Member
Posts: 353
Reputation Power: 13
Status: Offline
Joined: Mar 07, 20159Year Member
Posts: 353
Reputation Power: 13
All I need is guidance cuz I need to be able to explain some of it but ill just redo my whole thread and ill be back in a few
#6. Posted:
Boston-Bruins
  • V5 Launch
Status: Offline
Joined: May 14, 201013Year Member
Posts: 2,645
Reputation Power: 123
Status: Offline
Joined: May 14, 201013Year Member
Posts: 2,645
Reputation Power: 123
You forgot a semi-colon after the last alert
#7. Posted:
Skittle
  • 1000 Thanks
Status: Offline
Joined: Aug 20, 20149Year Member
Posts: 6,813
Reputation Power: 413
Status: Offline
Joined: Aug 20, 20149Year Member
Posts: 6,813
Reputation Power: 413
Images worked for me, uploaded them for yall;
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
#8. Posted:
YT_ReVoLuTiOnZ
  • V5 Launch
Status: Offline
Joined: Mar 07, 20159Year Member
Posts: 353
Reputation Power: 13
Status: Offline
Joined: Mar 07, 20159Year Member
Posts: 353
Reputation Power: 13
I think a lot of my "if statement might be wrong tho i dont really even know. I feel like I should have more variables I should have added but dont have in there
#9. Posted:
Bighair
  • Powerhouse
Status: Offline
Joined: Sep 26, 201013Year Member
Posts: 401
Reputation Power: 17
Status: Offline
Joined: Sep 26, 201013Year Member
Posts: 401
Reputation Power: 17
From what I see you're comparing the users name rather than the value rolled for them.

Think of it like this

Get user names

Declare user1num & user2num

Assign them random numbers.

Then compare the user nums rather than the names!
#10. Posted:
-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201013Year Member
Posts: 5,238
Reputation Power: 532
I'll put this all in pseudo code so I'm not actually doing it for you.

  • You need to store the name for both users, the dice roll for both users.
  • Ask the first user for their name and assign it to the variable you created.
  • Ask the second user for their name and assign it to the variable you created.
  • Generate a random number for the first user and assign it to their score variable.
  • Generate a random number for the second user and assign it to their score variable.
  • Compare the two score variables.
  • Output the name of which user won (or that it was a draw if that is the case).
  • Now we start from the beginning but need to compare their current scores and display them in order. (hint: use iteration to achieve this easily.)
  • At the end you need to check if either user has reached 5 points, if so end the game and output their congratulatory message.


Comparing this list of requirements against your current code, you need to add a variable to hold the score of user 2. You also need to change your comparison criteria.
Judging by how much you have already, you should be able to do this in only a couple of minutes.
If you still want help, feel free to PM me and I will explain it better.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.