Raised This Month: $ Target: $400
 0% 

Solved Searching in a text file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
WHOOHOO
Junior Member
Join Date: Aug 2016
Old 08-23-2020 , 08:48   Re: Searching in a text file
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
What part are you having issues with? You should provide the code that you tried so we can help you with your code.

There are several ways to do this and the best method will depend on how you are going to use the data. If you are looking up only for the current map and using that value for that map, you generally don't need to store the entire file in a variable. In this case, you would just loop through the lines of the file until your first argument matches the current map name and then you would grab the value that goes with it.

If all of the data is needed at any time, you should store all the data in variables in the plugin and then you'd look through that data to get what you need. There are several ways to do this, again depending on how you plan to use the data. Some are more complex than others.

Post your code and maybe explain how you're going to use the data so that we can help you out.



That is confusing and thus not really helpful, maybe worse than helpful.
Oh, I'm sorry for the confusion.
I'm trying to find the world record for the current map, It's for a kreedz server (I have them all stored in a file, the format is almost the same but I'll copy the whole thing so you can see for yourself)
And no, a trie would not be helpful since I don't need information about other maps, I just need to save the decimal time of the current map's world record in a variable so I'd be able to do stuff with it, for example show how much a player's record is slower than the WR.
And about my code, I failed to come up with anything that worked, I failed to figure out how that "Looping thru the data and searching for the first argument that matches up with current map" works.

Code:
8b1_brickngrass 229.39 Chasquido ar 642
8b1_hellinashop 127.44 topoviygus ru 665
ae_strafers_heaven 126.74 topoviygus ru 604
ak_rh_warehouse_ns 333.39 shooting-star cz 2
av_degyptianez 158.71 promax rs 539
bhop_its_2caves 324.36 fykseN cz 761
bkm_problock 146.9 topoviygus ru 588
The only part of my current code that is working is the part that I get the map name.
WHOOHOO is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode