ID:159623
![]() Feb 7 2009, 6:33 am
|
|
Well, I'm trying to go through member pages and parse through HTML to find the game they're playing. I have no clue where I would start. I could hear some copytext()'s and findtext()'s possibly screaming at me but that's all.
|
Actually..What I meant was finding the complete hub using copytext() and findtext(), but that link does help. =D
Here's what I think it should look like: var/hub = world.Export("http://byond.com/members/[key]?format = text") EDIT: The only problem is I can't figure out how I'd find the length of the name of the game their on. Or else it'd just be blindly copytexting stuff that's not part of the URL. |
Choka wrote:
The only problem is I can't figure out how I'd find the length of the name of the game their on. Or else it'd just be blindly copytexting stuff that's not part of the URL. Why would you need to use find/copytext() here? "I'm gonna let everyone in on a little secret. The format=text stuff is designed in BYOND savefile format." Nadrew id:639687 |
How am I to export the vars? I tried the following:
friend.game_name = data["name"] |
It didn't work like that D:. It was still null. I know, I have it set to show up in the output chat as a test =D.
|
Apparently >> is virtually useless/superfluous except when dealing with objects, since I've seen people just using SF["dir"] directly to access the value there (basically like with an associative list).
Though, more insight on this definitely won't hurt. |
Hub() I just used findtext to see if it was even in there ;D. You can ignore it if you want... and the world stuff. THat was also to see if it was null. |
Naturally if the directory isn't in the root of the savefile, you can't just access it immediately and expect DM to find it on its own throughout the savefile; you need to navigate to it first, or specify the path to it, whether relative or full.
Also, setting a var to any value just before reading a value from a savefile into it is completely pointless; it has no effect and the value is immediately overwritten by the value from the savefile. So it's really quite equivalent to setting a var to 1, and then immediately to 2; incidentally the only ways to set a var's value in DM are the >> and = (and its 'family') operators. |
...Well, look up savefile, cd and file() and file2text() for that matter, since you should look up any proc you're using. file() isn't for dealing with savefiles, and I don't think you're supposed to directly read them with file2text() either; you're probably abusing luck there.
|
file() is used to find a specific file within the game's directory with the path name you identify. If you type in just the file's name, it'll search the game's main directory, while if you type in something like "Savefiles/text.txt" it'll find the text.txt file in the Savefiles folder in the game's directory. But you already knew that, right? ;p
|
Abusing luck? And can I replace file2text with ExportText or what?
EDIT: Nevermind on ExportText, not even related. But what would i use instead of file2text then? |
I just compiled (and tested) a little snippet that I created using Nadrews posting that I linked to earlier ( id:639687 ).
mob This should enable you to change it to your needs. Edit: Gah! Evil! Just saw that you had made another post and got an answer there already as well... *sighs* |
Click here