Posts: 8
Threads: 1
Joined: Jun 2012
Reputation:
0
Answer to my question:
<script type="text/javascript">
clippy.load('Merlin', function(agent) {
// Do anything with the loaded agent
agent.show();
agent.play('Wave');
agent.speak(' <?php
$content = trim(file_get_contents('quotes.txt'));
$quotes = explode("\n", $content);
echo $quotes[rand(0, count($quotes)-1)];
?>');
agent.play('LookLeft');
});
</script>
Posts: 8
Threads: 1
Joined: Jun 2012
Reputation:
0
someone knows how to do an infinite loop that writes the random quote, waits 30 seconds and writes another?
Posts: 148
Threads: 9
Joined: Mar 2012
Reputation:
6
<code>
<script type="text/javascript">
clippy.load('Merlin', function(agent) {
// Do anything with the loaded agent
agent.show();
agent.play('Wave');
setInterval(function() {
agent.speak(' <?php
$content = trim(file_get_contents('quotes.txt'));
$quotes = explode("\n", $content);
echo $quotes[rand(0, count($quotes)-1)];
?>');
// Do something every 30 seconds
}, 30000);
agent.play('LookLeft');
});
</script>
</code>
This should do it, but is NOT tested. setInterval is standard javascript.
http://forum.jquery.com/topic/jquery-set...l-function
CompTIA A+ 602 Certified
Cisco Certified Entry Network Technician (Expired)
Google Developer Expert for Web Technology
Posts: 8
Threads: 1
Joined: Jun 2012
Reputation:
0
Thanks Garbee.
It almost works. The only problem is that repeats the same thing over and over :_(
Posts: 148
Threads: 9
Joined: Mar 2012
Reputation:
6
In that case it needs to be done from within PHP as well, a little out of my zone there.
CompTIA A+ 602 Certified
Cisco Certified Entry Network Technician (Expired)
Google Developer Expert for Web Technology