HttpObject
by Matthew Grint · in Torque Game Engine · 09/20/2005 (12:32 pm) · 6 replies
Hi,
Sorry to post a similar thread to my previous one but I am having more problems with httpObject.
I am trying to use schedule(); to get a function to wait until onLine has returned with an answer before the calling function returns. Is there any way to do this?
Thanks,
Matthew Grint
Sorry to post a similar thread to my previous one but I am having more problems with httpObject.
I am trying to use schedule(); to get a function to wait until onLine has returned with an answer before the calling function returns. Is there any way to do this?
Thanks,
Matthew Grint
About the author
#2
Another quick question - is there a way to convert HTML characters to standard ASCII characters within Torque without having to code a script to parse it?
For example converting "<" to "<".
Thanks,
Matthew Grint
09/21/2005 (10:29 am)
Thanks Ben,Another quick question - is there a way to convert HTML characters to standard ASCII characters within Torque without having to code a script to parse it?
For example converting "<" to "<".
Thanks,
Matthew Grint
#3
1. On the HTTP server, you have a custom PHP, ASP, or whatever program that returns data in a format compatable with Torque
2. You write a C++ function to parse lines and convert HTML ampersand escapes to their correct text equivalent.
3. You write a script function to parse the lines and convert the HTML ampersand escapes to their correct text equivalent.
For reference see the following resources:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4746 - Note this resource uses TCPObject
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3176
09/21/2005 (10:40 am)
There are at least three ways you could do this.1. On the HTTP server, you have a custom PHP, ASP, or whatever program that returns data in a format compatable with Torque
2. You write a C++ function to parse lines and convert HTML ampersand escapes to their correct text equivalent.
3. You write a script function to parse the lines and convert the HTML ampersand escapes to their correct text equivalent.
For reference see the following resources:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4746 - Note this resource uses TCPObject
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3176
#4
This is the code of the function:
There is definitly a value (%line) being passed to it, but it always fails at the if(%line...) stage and if I modify this slightly, %line and %question continue to be empty throughout.
Below is where it appears in my console.log with trace(1).
Thanks for any help.
09/21/2005 (10:48 am)
Excellent, I just had to adjust my PHP code slightly but it wasn't the cause of a bigger problem that I was having. What happens is the function doesn't seem to recognise that there is a value being passed to it.This is the code of the function:
function NPCchat::onLine( %this, %line )
{
if(%line != "" && %line != " "){
%question = %line;
furtherNPC(%question);
}
}There is definitly a value (%line) being passed to it, but it always fails at the if(%line...) stage and if I modify this slightly, %line and %question continue to be empty throughout.
Below is where it appears in my console.log with trace(1).
Entering NPCchat::onLine(1709, Hello, <<PlayerName>>. I am <<Name>>. This is a test. <AnswerStart><a:RPGDialog 1>Continue...</a><a:RPGDialog 2>Other Option</a>)
Thanks for any help.
#5
09/21/2005 (2:46 pm)
You're using the wrong operators in the if. String comparison is $= (or !$= inequality)
#6
10/05/2005 (4:10 pm)
Harold: i've been trying to use the HTTPObject with IIS6.0 but for some reason it will only process any HTML lines and seems to stop processing output when it reaches <% ie any response.write lines. Any ideas?
Associate Kyle Carter