Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by bula · Dec 06, 2011 at 05:05 PM · javascriptcharacter

Sprint Error script?

I just made a script for sprinting:

 //The Sprint script
 if( Input.GetButtonDown("Shift")) {
 maxForwardSpeed = maxSprintSpeed ;
 maxSidewaysSpeed = maxSprintSpeed ;
 maxBackwardSpeed = "0" ;

} if (Input.GetButtonUp("Shift")) { maxForwardSpeed = maxForwardSpeed ; maxSidewaysSpeed = maxSidewaysSpeed ; maxBackwardSpeed = maxBackwardSpeed ; } What is the problem with this script?

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dannyskim · Dec 06, 2011 at 05:09 PM 0
Share

Need more of your script to deter$$anonymous$$e what's wrong, the error along with it would be helpful as well.

avatar image bula · Dec 06, 2011 at 05:11 PM 0
Share

And the errors are : 1.

Assets/Standard Assets/Character Controllers/Sources/Scripts/Character$$anonymous$$otor.js(37,42): UCE0001: ';' expected. Insert a semicolon at the end.

2. Assets/Standard Assets/Character Controllers/Sources/Scripts/Character$$anonymous$$otor.js(37,9): BCE0044: expecting }, found 'if'.

3. Assets/Standard Assets/Character Controllers/Sources/Scripts/Character$$anonymous$$otor.js(38,21): BCE0044: expecting :, found '='.

avatar image ptdnet · Dec 06, 2011 at 05:19 PM 0
Share

The compiler comment "Insert a semicolon at the end." seems pretty self-evident.

avatar image bula · Dec 06, 2011 at 05:20 PM 0
Share

Its not if you think its telling me to add a semicolon after a if function or is it?

avatar image FLASHDENMARK · Dec 07, 2011 at 04:13 PM 0
Share

The code you provided contains no errors other than "cannot convert string to int" and "WARNING: Assignments made to same expression. Did you mean to assign to something else?"

BiG already fixed the "cannot convert string to int" error, and the other are just warnings meaning you make no change whatsoever.

The code you gave use are not producing the errors something else must be doing so.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ptdnet · Dec 06, 2011 at 05:17 PM

this:

 maxForwardSpeed = maxForwardSpeed ;

doesn't make any sense.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bula · Dec 06, 2011 at 05:18 PM 0
Share

how should i weite it then? :))

avatar image FLASHDENMARK · Dec 07, 2011 at 04:03 PM 0
Share

Even if it doesn't make sense, it would not give errors, or at least not the ones the OP described.

avatar image
0

Answer by BiG · Dec 07, 2011 at 07:41 AM

I imagine maxBackwardSpeed as an Integer variable. If so, you have to declare it as

 maxBackwardSpeed = 0;

and not as

 maxBackwardSpeed = "0";
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bula · Dec 07, 2011 at 03:49 PM 0
Share

Yeah...still no diffrence for the error.. Any more ideas? Need more script?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Setting Scroll View Width GUILayout 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers

What is a good unityscript writing program? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges