Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-07-2006, 08:51 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
RequestURL woes

NPC Code:

function onTimeout() {
xr = player.chat.tokenize();
switch(xr[0]) {

case ":ar":
player.chat = "doing..";
this.req = requestURL(xr[1]);
catchEvent(this.req,"onRecieveData","onData");
break;

}
setTimer(.05);
}

function onData(obj) {
player.chat = obj;
}



Obj returns nothing. Absolutely nothing. The chat stays doing.. for the default chat timeout and just disappears. Now the interesting part:

If I were to do player.chat = this.req right below it, and the url was, say http://www.di.fm/aacplus/lounge.pls, i'd get:

HTTP_www.di.fm_80_/aacplus/lounge.pls

Which of course, yields nothing any closer to parsing it into a stream.

And also, if I extract the ip/port of the stream from the pls file manually, and try to play it within graal, it doesnt work. Why?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #2  
Old 07-07-2006, 09:57 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Should be "onReceiveData" or "receivedata"
Reply With Quote
  #3  
Old 07-07-2006, 02:35 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
So I should change onData to onRecieveData?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #4  
Old 07-08-2006, 01:24 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Recieve is spelled Receive. I before E except after c.

catchEvent(this.req,"onRecieveData","onData");
needs to be changed to:
catchEvent(this.req,"onReceiveData","onData");
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 07-08-2006, 05:25 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Oh, forgot that :o

Still doesnt work
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #6  
Old 07-09-2006, 12:47 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
onData is never called? You do it on clientside right ?
Reply With Quote
  #7  
Old 07-09-2006, 04:56 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Of course. onData simply is never called.
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #8  
Old 07-12-2006, 07:40 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Do you even call onTimeout();?
Reply With Quote
  #9  
Old 07-12-2006, 07:43 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
why are you using timeout to watch the player's chat?
Reply With Quote
  #10  
Old 07-12-2006, 09:58 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by KuJi
Do you even call onTimeout();?
... I believe there's a rule about responses like this.

Quote:
Originally Posted by Rick
why are you using timeout to watch the player's chat?
Heh, good point.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #11  
Old 07-12-2006, 10:11 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
onTimeout is called in onCreated. This is in a 300 line script, like i'm going to cut it all anyway :[

So besides correcting each other and backseat moderating, are any of you going to actually make any input or is the thread going to go inactive again?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #12  
Old 07-12-2006, 11:32 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Raeiphon
onTimeout is called in onCreated. This is in a 300 line script, like i'm going to cut it all anyway :[

So besides correcting each other and backseat moderating, are any of you going to actually make any input or is the thread going to go inactive again?
So why not simply use onPlayerChats() to lower *the lag*?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #13  
Old 07-12-2006, 12:59 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Hey um, that's nice, if you'd read the previous posts you'd know why it was like that.

Have you got ANYTHING to contribute as to why requestURL isnt working or are you going to continually poke at my coding style?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #14  
Old 07-13-2006, 02:14 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Uh, you can't do catchEvent on events like that. It just doesn't work for some reason. You should use the standard onReceiveData() function, and pass that to onData().

PHP Code:
function onReceiveData(params...) {
  
onData(params...);

__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #15  
Old 07-14-2006, 04:04 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by ForgottenLegacy
Uh, you can't do catchEvent on events like that. It just doesn't work for some reason. You should use the standard onReceiveData() function, and pass that to onData().

PHP Code:
function onReceiveData(params...) {
  
onData(params...);

you can do catchEvent like that. I think you may have to do it like this, though: catchevent(this.req.name, ...)

Try that and see if it works.


Quote:
Originally Posted by Raeiphon
Hey um, that's nice, if you'd read the previous posts you'd know why it was like that.
Actually, you made no mention to why it is in a timeout, and not just in an onPlayerChats() handler. I can not think of any reason why you would need such a thing in a timeout.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:12 PM.


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