What abot seperate images for tbg main site and offline?
Offline
sparks wrote:
I can't make the API display text on the Scratch fora because Scratch won't take text from external sources, only images!
Bad Excuse. You can figure it out.
Find some text to image generating thing? And then only the ones that are used will be kept on the site?
Offline
LiquidMetal wrote:
sparks wrote:
I can't make the API display text on the Scratch fora because Scratch won't take text from external sources, only images!
Bad Excuse. You can figure it out.
Find some text to image generating thing? And then only the ones that are used will be kept on the site?
Done a crude one of those already. Look at the last page!
Offline
also sparks, typo in the code, should be 'strpos' not 'strrpos' (double r).
Offline
sparks wrote:
Done a crude one of those already. Look at the last page!
Can't find it, can I have a link?
Also, what if my online picture to link to one place and my offline picture to link to another?
Offline
strrpos() is a command. Believe me, if it was a typo the code wouldn't work!
strpos: position of first occurrence of a string working from left to right.
strrpos: position of first occurrence of a string working from right to left.
Offline
LiquidMetal wrote:
sparks wrote:
Done a crude one of those already. Look at the last page!
Can't find it, can I have a link?
Also, what if my online picture to link to one place and my offline picture to link to another?
http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055
Your online and offline images can be hosted anywhere and don't need to be in the same place.
Offline
scimonster wrote:
It's just reading the fora's (that sounds better ) online list, making it lowercase, and comparing it to the user variables as lowercase, right?
In that instance, it would have been forums. When a word starts with a vowel, you would have place forums
Offline
wulfmaster wrote:
scimonster wrote:
It's just reading the fora's (that sounds better ) online list, making it lowercase, and comparing it to the user variables as lowercase, right?
In that instance, it would have been forums. When a word starts with a vowel, you would have place forums
no, it would be forum's as it's belonging to the forum.[/offtopic]
Last edited by sparks (2011-07-20 17:52:23)
Offline
comp500 wrote:
comp500 wrote:
sparks, here's the generator: http://www.mdn.fm/files/321024_fweoa/apigen.htm If you want to use it, i suggest u host it on blocks.scratchr.org and maybe edit it...
i'll finish it tormorrow if i can cos i g2g now
Try this link!! It those exist! 18.85.28.105
Offline
SeptimusHeap wrote:
What abot seperate images for tbg, main site and offline?
Offline
sparks wrote:
strrpos() is a command. Believe me, if it was a typo the code wouldn't work!
strpos: position of first occurrence of a string working from left to right.
strrpos: position of first occurrence of a string working from right to left.
Ah should have seen that one coming.
Well anyway, thought I'd submit some code to this.
This one finds the users newest friend, the code will need some modification to read stuff from the url vars but anyway it's all commented so you know what to do.
It uses the code from your text to image (it just uses that page to generate it as you hadn't released the code for it yet) it also redirects to the latest friends user page, you'll need to if statement it up, all within your capability I'm sure well anyway here it is:
//Common Code $username_from_url = 'RUMCHEERYPOOPOO'; //Stick all the other stuff in I can't be bothered :D $userpageurl = 'http://scratch.mit.edu/users/' . $username_from_url; $page = ltrim(file_get_contents($userpageurl)); $startpos = strpos($page, 'rel-1') + 33; $endpos = strpos($page, '"', $startpos); $length = $endpos - $startpos; $refined = substr($page, $startpos, $length); //**** Displays image of newest friend ****\\ $textimage = 'http://blocks.scratchr.org/API.php?action=text&string=' . $refined; echo file_get_contents($textimage); //**** ****\\ You'll need to seperate out with if statements based on the url, but I can't be bothered again //**** Links to newest friend ****\\ header("Location:http://scratch.mit.edu/users/$refined"); exit();
Edit: just so you know, I tested it and I think it works
Last edited by RUMCHEERYPOOPOO (2011-07-20 18:00:35)
Offline
sep, I answered you eariler I said I'll consider it, it's a good idea but I might not going to work on it much tomorrow as I'm a bit nervous about the elections...
Rum, that code looks good though I'll probably use the existing Scratch friends API the ST made to get the friends. Then people will be able to display the n'th friend, rather than end up limited to the latest 5
Offline
*shakes fist* (oops looks like I'm not allowed to say [removed]) ready made APIs
Last edited by Paddle2See (2011-07-21 05:07:44)
Offline
So what official APIs exist already?
Offline
hehe sorry
Offline
if($_GET['action'] == 'friends'){ if($_GET['type'] == 'newest'){ $page = ltrim(file_get_contents('http://scratch.mit.edu/api/getfriendsbyusername/' . $_GET['user'])); $count = '0'; $placeholder = '0'; while ($count < $_GET['num'] - '1'){ $placeholder = strpos($page, ':', $placeholder + '1'); $count ++; } if($count > 0){ $placeholder++; } $endplaceholder = strpos($page, ':', $placeholder + 1); if($_GET['return'] == 'image'){ #echo "<img src = 'http://scratch.mit.edu/static/icons/buddy/" . substr($page, $placeholder, $endplaceholder - $placeholder) . "_sm.png' />"; < this echoes the image rather than the file. For glitch testing. echo file_get_contents('http://scratch.mit.edu/static/icons/buddy/' . substr($page, $placeholder, $endplaceholder - $placeholder) . '_sm.png'); } if($_GET['return'] == 'link'){ $user = $_GET['user']; $userguy = substr($page, $placeholder, $endplaceholder - $placeholder); echo "<meta http-equiv='REFRESH' content='0;url=http://scratch.mit.edu/api/getuser/" . $userguy . "'>"; } } }
Last edited by SeptimusHeap (2011-07-20 18:22:26)
Offline
:p
what was the edit for?
Last edited by RUMCHEERYPOOPOO (2011-07-20 18:23:25)
Offline
sparks wrote:
http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055
Your online and offline images can be hosted anywhere and don't need to be in the same place.
We want black on nothing, not white on black, but its a good start. Did you ever figure out spaces?
I guess I was unclear there. What I mean is, for example (though why anyone would do this example I don't know), while I am online, I have a block that says LiquidMetal, linking to my user page, and while I am offline, there is the block library logo, linking to the block library. How would I do that?
Offline
you'd have to change the api to do that as you would need it to redirect to different pages depending on the persons online status
Offline
RUMCHEERYPOOPOO wrote:
:p
what was the edit for?
I added the smileys
Anyway, liquid, stop demanding stuff unless you make it yourself. Sparks is 18. He can manage, he just doesn't have the time...
EDIT: Can someone test my code?
Last edited by SeptimusHeap (2011-07-20 18:37:04)
Offline
LiquidMetal wrote:
sparks wrote:
http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055
Your online and offline images can be hosted anywhere and don't need to be in the same place.We want black on nothing, not white on black, but its a good start. Did you ever figure out spaces?
I guess I was unclear there. What I mean is, for example (though why anyone would do this example I don't know), while I am online, I have a block that says LiquidMetal, linking to my user page, and while I am offline, there is the block library logo, linking to the block library. How would I do that?
The different links thing is impossible on these forums, unless the scratchteam edited the forums. As for black on nothing, that should be fairly easy.
I'm trying to figure out how to display any text. If I can do this, then a LOT is possible
Last edited by gbear605 (2011-07-20 20:24:17)
Offline
gbear605 wrote:
LiquidMetal wrote:
sparks wrote:
http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055
Your online and offline images can be hosted anywhere and don't need to be in the same place.We want black on nothing, not white on black, but its a good start. Did you ever figure out spaces?
I guess I was unclear there. What I mean is, for example (though why anyone would do this example I don't know), while I am online, I have a block that says LiquidMetal, linking to my user page, and while I am offline, there is the block library logo, linking to the block library. How would I do that?The different links thing is impossible on these forums, unless the scratchteam edited the forums. As for black on nothing, that should be fairly easy.
It is possible, look at the newest project link part.
Anyway remind sparks of the code I wrote if he gets on...
Offline