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 aeronicweb · Jan 09, 2014 at 08:53 AM ·

getting high score of game from asp.net page

I have implemented a script to get latest score from asp.net page using below code

 IEnumerator GetScores()
     {
         //gameObject.guiText.text = "Loading Scores";
         WWW hs_get = new WWW(highscorePageURL);
         yield return hs_get;
         
         if (hs_get.error != null)
         {
             print("There was an error getting the high score: " + hs_get.error);
         }
         else
         {
             lbl1.text = hs_get.text;
         //    gameObject.guiText.text = hs_get.text; // this is a GUIText that will display the scores in game.
         }
     }


it is getting score but also gets html code of this page too. i have attached screenshot what it returnsalt text

can anyone figure out what should i do to get only score instead of full code of page ?

thanks in advance

error.jpg (107.0 kB)
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by aeronicweb · Jan 09, 2014 at 10:50 AM

After many efforts i fixed it my self. I used regular expression in unity3D to separate value for this like

 public void matchh()
     {
         string txt = newscore;
         //string txt="adasdadasd <bst>60</bst> asedsadadasddasd sdasdadadas";
     Regex r = new Regex(re1+re2+re3+re4+re5+re6+re7+re8+re9+re10+re11+re12+re13,RegexOptions.IgnoreCase|RegexOptions.Singleline);
     Match m = r.Match(txt);
     if (m.Success)
     {
         String c1=m.Groups[1].ToString();
         String c2=m.Groups[2].ToString();
         String c3=m.Groups[3].ToString();
         String c4=m.Groups[4].ToString();
         String c5=m.Groups[5].ToString();
         String int1=m.Groups[6].ToString();
         String c6=m.Groups[7].ToString();
         String c7=m.Groups[8].ToString();
         String c8=m.Groups[9].ToString();
         String c9=m.Groups[10].ToString();
         String c10=m.Groups[11].ToString();
         String c11=m.Groups[12].ToString();
         lbl1.text=    (int1.ToString());
     }
 
     }

and now its showing only score instead of whole html code

Comment
Add comment · 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
0

Answer by nikroth · Jan 09, 2014 at 10:50 AM

You can't get a single element with a command. You get the html code.

HTML is in XML format so you can remove the first line and then parsi it as an XML and get the element you want.

Or you can place the score in a hidden field and with String.IndexOf you can find the position where the value is and then parse it to int.

Just accept that you have a text and you have to find your value in the text.

Comment
Add comment · 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

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

19 People are following this question.

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

Related Questions

How to draw an arrow from fps contoller 1 Answer

,Roll a ball - project 0 Answers

Mathf.pingpong 4 Answers

colliders with touch 0 Answers

audio not playing when i destroy gameobject or setactive to false,audio not playing when i destroy gameobject or setactive into false 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