Now there is this code on the script :
Code: Select all
Value := TextBetween(PageText, '<div id="game_info"', '<br />');
Line := RemainingText;
Value := TextAfter(Value, '>');
Here we have two variables that are set (Value, Line). On the first line Value is set to a specific string from PageText (= HTML source code of game's website). You should open the source code window now, and try to find the
div id="game_info" string there (use the search function). You will see that this string is on line 121 within some other code
Code: Select all
......</div></div><div id="game_info">Macintosh / PC<br />Adventure<br /> single player<br /><br />Ontwikkeld door....
What the script does is, that the string between
<div id="game_info" and
<br /> is copied to variable Value.
So variable Value now contains
On the next line it copies the remaining string to variable Line (everything behind the
<br />, starting with
Adventure...
The next line then gets rid of the leading
>, so that the result is
Well, now we have the platform(s) in variable Value: Macintosh / PC. What we need to do is store them on corresponding field. When you open SGC helpfile from editor you know about the list of fieldnames. There you will identify fieldPlatform as correct name for it. Now add a line of code behind previous lines that saves the platform to fieldPlatform:
Code: Select all
Value := TextBetween(PageText, '<div id="game_info"', '<br />');
Line := RemainingText;
Value := TextAfter(Value, '>');
setField(fieldPlatform, Value);
That's it. Now the script imports the platform, too.
If something goes wrong, you can easily check what the script does. If you don't know about that, you should try it now, even if everything is going ok. On script editor set breakpoints for the four lines. That means you click on the left side near the line number, inside the grey frame (left beside the numbers 40, 41, 42, 43). The lines should turn red and script execution will now pause on these lines. Now right-click on the variables "Value" and "Line" and add them to the watch list ("Add watch"). The watch list should open, if it resides on the right side of your window you should drag it to the bottom of the window, so that you can see longer variables. Run the script. It should stop on line 40. Variable Value shows
Safecracker. Click run, the script will execute one more line, variable Value changes correctly to
Macintosh / PC. Hit run again, and the script will execute line 41, so that variable Line changes to a longer string beginning with
Adventure.... Nice...
You should add a short outcommented description above these lines, so that others know what is going on:
Code: Select all
// platform
Value := TextBetween(PageText, '<div id="game_info"', '<br />');
Line := RemainingText;
Value := TextAfter(Value, '>');
setField(fieldPlatform, Value);
That's it. Sounds complicated ? Not really. And if you once understood what is going on, you might be able to fix the script on your own, when it should be broken in future.
Please ask if anything isn't clear or doesn't work.