Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Dictionary (https://forums.graalonline.com/forums/showthread.php?t=69147)

fowlplay4 10-03-2006 11:47 PM

Dictionary
 
Dictionary
Heres my functions :D, while playing with this script you'll find many funny definitions. LOL
Quote:

Requesting Definition of boobies:
- small tropical gannet having a bright bill or bright feet or both
- an ignorant or foolish person
PHP Code:

function Define(word) {
 
temp.link "http://www.onelook.com/?w=" word "&ls=a";
 echo(
"Requesting Definition of" SPC word ":");
 
temp.req requesturl(temp.link);
 
this.catchevent(temp.req,"onReceiveData","onDefine");
}
function 
onDefine(obj) {
 
temp.toks obj.fulldata.tokenize("\n");
 for(
btemp.toks) {
  if (
== "<LI>") continue;
  if (
b.starts("<LI>") > 0) {
   
temp.ntoks b.tokenize(";");
   
temp.npos temp.ntoks[2].pos("(");
   
temp.defin temp.ntoks[2].substring(0,temp.npos);
   if (
temp.defin.length() > 1) echo(" - " temp.defin);
   
temp.msg++;
  }
 }
 if (
temp.msg == 0) echo("No Definitions Found!");



KuJi 10-03-2006 11:59 PM

Haha, that's a pretty cool idea lol

P.S. Repped.. and I think you get like 5 rep points from me too ;)

xAndrewx 10-04-2006 08:18 AM

Great Idea +1 Rep

Twinny 10-04-2006 09:46 AM

Why would graal need this? >_<

KuJi 10-04-2006 01:10 PM

Quote:

Originally Posted by Twinny (Post 1225841)
Why would graal need this? >_<

Because some people don't know words =o?

xXziroXx 10-04-2006 02:46 PM

Haha, a script that made me laugh.. originall and a hillarious, yet usefull idea. Heres your rep!

contiga 10-04-2006 07:55 PM

Funny! Rep++;

Rapidwolve 10-05-2006 12:20 AM

Quote:

Originally Posted by Twinny (Post 1225841)
Why would graal need this? >_<

Its a good tool for when your on RC and you would like to find the definition of a word without having to open a web browser and such. I'm sure there are many more other reasons why it would be good to have too.

smirt362 10-05-2006 02:03 AM

Nifty!

fowlplay4 10-05-2006 03:25 AM

Quote:

Originally Posted by Rapidwolve (Post 1226051)
Its a good tool for when your on RC and you would like to find the definition of a word without having to open a web browser and such. I'm sure there are many more other reasons why it would be good to have too.

Exactly why I made it.

Chompy 10-05-2006 12:50 PM

bingo! looks funny :)
:pluffy: --> Rep time!

Rapidwolve 10-06-2006 12:07 AM

I've already given you rep before Chompy ;)

Chompy 10-06-2006 12:55 PM

Quote:

Originally Posted by Rapidwolve (Post 1226480)
I've already given you rep before Chompy ;)

<3 Thanks :D

killerogue 04-18-2007 12:10 AM

Hate to revive this, but just read it and found it to be useful. But I've tried a few ways to call the function but it didn't quite work.

What's the issue? Or how should I do it? As I am obviously doing it wrong..:P

Chompy 04-18-2007 12:34 PM

Quote:

Originally Posted by killerogue (Post 1300799)
Hate to revive this, but just read it and found it to be useful. But I've tried a few ways to call the function but it didn't quite work.

What's the issue? Or how should I do it? As I am obviously doing it wrong..:P

Call the function serverside with a word as the parameter
for example you can make a class and have a little script in the Control-NPC:

dictionary (class):
PHP Code:

function Define(word) {
 
temp.link "http://www.onelook.com/?w=" word "&ls=a";
 echo(
"Requesting Definition of" SPC word ":");
  
temp.req requesturl(temp.link);
 
this.catchevent(temp.req,"onReceiveData","onDefine");
}
function 
onDefine(obj) {
 
temp.toks obj.fulldata.tokenize("\n");
 for(
btemp.toks) {
  if (
== "<LI>") continue;
  if (
b.starts("<LI>") > 0) {
   
temp.ntoks b.tokenize(";");
   
temp.npos temp.ntoks[2].pos("(");
   
temp.defin temp.ntoks[2].substring(0,temp.npos);
   if (
temp.defin.length() > 1) echo(" - " temp.defin);
   
temp.msg++;
  }
 }
 if (
temp.msg == 0) echo("No Definitions Found!");


Control-NPC
PHP Code:

function onCreated()
 
join("dictionary");
public function 
onRCChat() {
 if (
params[0] == "defineword") {
  
temp.word params[1];
  
Define(temp.word);
 }


can be a part of the Control-NPC script at the bottom and then..
NPC Code:
 /npcdefineword <word here>


in RC chat


I think that should work..


All times are GMT +2. The time now is 09:17 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.