|
Joined: Apr 2005
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Apr 2005
Posts: 6 |
I am learning to write scripts in sockets. With the help file I wrote a small script but it have some problems. someone can see into it and please check whats wrong. I am getting the following errors are
* /if: invalid format (line 17, script1.nns)
Line 17 is: if (<td>Attack Specialist</td>
the script is as follows
on *:sockopen:mercs:{ sockwrite -n $sockname GET /mercs.php HTTP/1.1 sockwrite -n mercs User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.40607; .mIRC) sockwrite -n $sockname Host: kingsofchaos.com $+ $crlf $+ $crlf }
on *:sockread:mercs:{ if ($sockerr) { echo -a Error. halt } else {
var %temptext
sockread %temptext if (<td>Attack Specialist</td> <td align="right">4,500 Gold</td> <td align="right">*</td> iswm %temptext) || (<td>Defense Specialist</td> <td align="right">4,500 Gold</td> <td align="right">*</td> iswm %temptext) || (<td>Untrained</td> <td align="right">3,500 Gold</td> <td align="right">*</td> iswm %temptext) {
echo -a -
/echo -s $htmlfree(%temptext)
} } }
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
try if (<td>Attack Specialist</td> $&
<td align="right">4,500 Gold</td> $&
<td align="right">*</td> iswm %temptext) || (<td>Defense Specialist</td> $&
<td align="right">4,500 Gold</td> $&
<td align="right">*</td> iswm %temptext) || (<td>Untrained</td> $&
<td align="right">3,500 Gold</td> $&
<td align="right">*</td> iswm %temptext) {
* untested, but the $& allows you to split a single command over multiple lines, so should work. [edit] if that doesnt work try
if (<td>Attack Specialist</td><td align="right">4,500 Gold</td><td align="right">*</td> iswm %temptext) $&
|| (<td>Defense Specialist</td><td align="right">4,500 Gold</td><td align="right">*</td> iswm %temptext) $&
|| (<td>Untrained</td><td align="right">3,500 Gold</td><td align="right">*</td> iswm %temptext) {
Last edited by DaveC; 06/04/05 10:33 AM.
|
|
|
|
Joined: Apr 2005
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Apr 2005
Posts: 6 |
one more thing in website code. on random timing webmaster replace None with with digits. is it possible when he replace the none with digits we get the alter in channel. Lets say channel #heretics
<tr> <td>Attack Specialist</td> <td align="right">4,500 Gold</td> <td align="right"> None </td> <td align="center"><input type="text" name="mercs[attack]" size="3" value="0"></td> </tr>
<tr> <td>Defense Specialist</td> <td align="right">4,500 Gold</td> <td align="right"> None </td> <td align="center"><input type="text" name="mercs[defend]" size="3" value="0"></td> </tr>
<tr> <td>Untrained</td> <td align="right">4,500 Gold</td> <td align="right"> None </td> <td align="center"><input type="text" name="mercs[general]" size="3" value="0"></td> </tr>
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Ill answer that with a YES, how to do it i dont know, becuase I dont know what your even doing.
|
|
|
|
Joined: Apr 2005
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Apr 2005
Posts: 6 |
I tried the changes you suggested. but still its not working. It does not give any error now but it also done show any data even I tried /sockread mercs command
Now my script look like this
on *:sockopen:mercs:{ sockwrite -n $sockname GET /mercs.php HTTP/1.1 sockwrite -n mercs User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.40607; .mIRC) sockwrite -n $sockname Host: kingsofchaos.com $+ $crlf $+ $crlf }
on *:sockread:mercs:{ if ($sockerr) { echo -a Error. halt } else {
var %temptext
sockread %temptext if (<td>Attack Specialist</td><td align="right">4,500 Gold</td><td align="right">*</td> iswm %temptext) $&
|| (<td>Defense Specialist</td><td align="right">4,500 Gold</td><td align="right">*</td> iswm %temptext) $&
|| (<td>Untrained</td><td align="right">3,500 Gold</td><td align="right">*</td> iswm %temptext) {
echo -a -
/msg #hasan -s $htmlfree
} } }
I have pm you my user email and password. So if you want to test it please.
|
|
|
|
Joined: Oct 2004
Posts: 31
Ameglian cow
|
Ameglian cow
Joined: Oct 2004
Posts: 31 |
I have pm you my user email and password. So if you want to test it please.
Hehe, thats illegal, I should report you =P I made one myself yesterday It wouldnt work, so I tried to find out why I echoed the %temptext everytime it read, and it gave me some bull I finally realized that it wont work (unless you use dll which I dont know) because KoC doesnt recognise you are logged in My question tol people who have been scripting awhile is: Is there a way to read text from a window you currently have open If you could have your KoC window ope, and specify it read from there, it would be possible As long as you are reading from a age you arent (and cant) log into, you cant read the data I know someone who had mercs script, and Ill talk to them and see how they did it Until them, I cant help anymore Bear
|
|
|
|
Joined: Feb 2005
Posts: 7
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Feb 2005
Posts: 7 |
kin i git yer passwerd?
;o
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
I hate cookies, especially the ones that change for every session! OK try this code, please note the blue bits you need to set yourself, I almost left yours in there (that would ahve been a booboo) You simply run /MERCS and it echos in channel if any are avalaibe (actually it echos if it dont say NONE) * It doesnt check if your in channel (im lazy!) You setup how often you wannna call mercs with a timer. Oh and yours didnt work becuase you didnt send gthe page the needed cookie and you didnt login to create the cookie. alias mercs {
sockclose mercs
sockopen mercs kingsofchaos.com 80
;
;echo -st RUNNING MERCS SOCKET
;
}
;
on *:sockopen:mercs:{
;
var %usrname = [color:blue]username[/color]
var %uemail = [color:blue]email[/color]
var %peeword = [color:blue]password[/color]
var %formvalues = $+(usrname=,%usrname,&uemail=,%uemail,&peeword=,%peeword)
;
;echo -st SOCKOPEN $sockname
;
sockwrite -n $sockname POST /login.php HTTP/1.1
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
sockwrite -n $sockname Host: www.kingsofchaos.com
sockwrite -n $sockname Content-Length: $len(%formvalues)
sockwrite -n $sockname $crlf
sockwrite -n $sockname %formvalues
}
;
on *:sockread:mercs:{
if ($sockerr) {
echo -st Error $sockname
}
else {
var %htmltext
sockread %htmltext
;echo -st - %htmltext
;
if (Set-Cookie:* iswm %htmltext) { set %mercs.cookie $mid(%htmltext,5) }
;
if (!%htmltext) {
sockclose $sockname
sockclose mercs2
sockopen mercs2 kingsofchaos.com 80
;
;echo -st RUNNING MERCS2 SOCKET
;
}
}
}
;
on *:sockopen:mercs2:{
;
;echo -st SOCKOPEN $sockname
;
sockwrite -n $sockname GET /mercs.php? HTTP/1.1
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
sockwrite -n $sockname Host: www.kingsofchaos.com
sockwrite -n $sockname %mercs.cookie
sockwrite -n $sockname $crlf
unset %mercs.cookie
;
set %mercs.line1
set %mercs.line2
set %mercs.line3
}
on *:sockread:mercs2:{
if ($sockerr) {
echo -st Error $sockname
}
else {
var %htmltext
sockread %htmltext
;echo -s = %htmltext
;
set %mercs.line1 %mercs.line2
set %mercs.line2 %mercs.line3
set %mercs.line3 $remove(%htmltext,$chr(9))
;
if ((%mercs.line1 == <td>Attack Specialist</td>) && (%mercs.line2 == <td align="right">4,500 Gold</td>) && (%mercs.line3 != <td align="right">None</td>)) $&
|| ((%mercs.line1 == <td>Defense Specialist</td>) && (%mercs.line2 == <td align="right">4,500 Gold</td>) && (%mercs.line3 != <td align="right">None</td>)) $&
|| ((%mercs.line1 == <td>Untrained</td>) && (%mercs.line2 == <td align="right">3,500 Gold</td>) && (%mercs.line3 != <td align="right">None</td>)) {
MSG #hasan AGHHHHHHHHHHHHHHHHH QUICK! There's $gettok($gettok(%mercs.line3,2-,62),1,60) $gettok($gettok(%mercs.line1,2-,62),1,60) available at $gettok($gettok(%mercs.line2,2-,62),1,60) each! run around run around panic panic!
}
}
}
* you might wanna change these 3 lines if ((%mercs.line1 == <td>Attack Specialist</td>) && (%mercs.line2 == <td align="right">4,500 Gold</td>) && (%mercs.line3 != <td align="right">None</td>)) $&
|| ((%mercs.line1 == <td>Defense Specialist</td>) && (%mercs.line2 == <td align="right">4,500 Gold</td>) && (%mercs.line3 != <td align="right">None</td>)) $&
|| ((%mercs.line1 == <td>Untrained</td>) && (%mercs.line2 == <td align="right">3,500 Gold</td>) && (%mercs.line3 != <td align="right">None</td>)) { to be if ((%mercs.line1 == <td>Attack Specialist</td>) && (%mercs.line3 != <td align="right">None</td>)) $&
|| ((%mercs.line1 == <td>Defense Specialist</td>) && (%mercs.line3 != <td align="right">None</td>)) $&
|| ((%mercs.line1 == <td>Untrained</td>) && (%mercs.line3 != <td align="right">None</td>)) { Do that and if the price changes it well still work. * it is possable that a reformated webpage well bring this down, but from what you have here you should be able to deal with any format changes.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
I finally realized that it wont work (unless you use dll which I dont know) because KoC doesnt recognise you are logged in Well the solution to that was to login then!
|
|
|
|
Joined: Apr 2005
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Apr 2005
Posts: 6 |
I dont think its illegal at all. The main purpose is to learn the scripting. and rectify the errors I am getting in my script.
and for this purpose I have to provide all the information to helper who is dedicating his time on my problems.
And I dont care if your report me or not Learning socket scripting on loss of my account is very cheap for me.
|
|
|
|
Joined: Oct 2004
Posts: 31
Ameglian cow
|
Ameglian cow
Joined: Oct 2004
Posts: 31 |
I finally realized that it wont work (unless you use dll which I dont know) because KoC doesnt recognise you are logged in Well the solution to that was to login then! I tried It doesnt recognise you are logged in Ill copy the message it gives me (I echoed all the sockreads and got the message) when I get home and have IRC and the script Bear
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Did you even check the rest of the messages in this thread? I have already done it.
|
|
|
|
Joined: Apr 2005
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Apr 2005
Posts: 6 |
I am getting error while running the script. I am using firefox 5.0 so i made a lil change in script.
I replace the user agent with Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
The error I get is.
[11:42] RUNNING MERCS SOCKET [11:42] SOCKOPEN mercs [11:42] - HTTP/1.1 400 Bad Request [11:42] - Proxy-Connection: Keep-Alive [11:42] - Connection: Keep-Alive [11:42] - Date: Mon, 11 Apr 2005 06:45:50 GMT [11:42] - Server: Apache/1.3.33 (Unix) (Gentoo/Linux) [11:42] - Transfer-Encoding: chunked [11:42] - Content-Type: text/html; charset=iso-8859-1 [11:42] - Age: 4031056 [11:42] - [11:42] RUNNING MERCS2 SOCKET [11:42] SOCKOPEN mercs2 = HTTP/1.1 302 Found = Proxy-Connection: Keep-Alive = Connection: Keep-Alive = Date: Mon, 11 Apr 2005 06:45:41 GMT = Server: Apache/1.3.33 (Unix) (Gentoo/Linux) = Set-Cookie: koc_session=64f996550bc3c1849ff5bc51202ebdd8; path=/; domain=.kingsofchaos.com = Expires: Thu, 19 Nov 1981 08:52:00 GMT = Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 = Pragma: no-cache = Location: login.php = Transfer-Encoding: chunked = Content-Type: text/html = = 0 = = HTTP/1.1 400 Bad Request = Cache-Control: no-cache = Pragma: no-cache = Content-Length: 2915 = Content-Type: text/html = Proxy-Connection: Keep-Alive = Connection: Keep-Alive =
|
|
|
|
Joined: Apr 2005
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Apr 2005
Posts: 6 |
Sorry for the double post. I was checking the script. I think we need a timer. script first goes to www.kingsofchaos.com and very next moment it went to other page mentioned under mercs2.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
You arent using firefox your using mIRC to do it, they were set becuase it produced a certian effect that i was looking for to start the second socket, however your change made no effect on that.
Did you place your user info in replace of the blue sections of the code? var %usrname = username var %uemail = email var %peeword = password
MOST IMPORTANTLY You may have inadvertently altered something else also. I cant reproduce the effect you recieved.
[11:42] RUNNING MERCS SOCKET [11:42] SOCKOPEN mercs [11:42] - HTTP/1.1 400 Bad Request <<<< This means your screwed from the start the http request went bad, so you didnt login thus everything else went to hell [11:42] - Proxy-Connection: Keep-Alive
|
|
|
|
|