mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#43366 21/08/03 06:15 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
I have seen in other scripts where u can click on a button in the script and it will ckeck to see if there are updates. How would i go about makeing something like this. I have tried somethings but it did not work Like I tried to uplaod a text file to my web hosting and then i tried to have my script read that text file to tell it what it says in the text file but i could not get it to work any help would be great for this

#43367 21/08/03 06:23 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
The easiest way would probably be to look at the code for a script that does exactly what you want to do.

#43368 21/08/03 06:35 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
here is what i tried and it does not work
Code:
 
dialog update {
  title Update Panel
  size -1 -1 400 500

  button "Ok" ,1, 0 475 75 25,ok
  button "Clear" ,3, 75 475 75 25

  Edit "" ,2, 5 3 390 470,read,multi
}
on *:dialog:update:sclick:3:{
  /did -ra update 2 $dname $read(http://www.area51script.fairmount.nu/update.txt)
}


I tried to find the scripts that did the updates I found one but it was done in a dll file and I don't know how to work with dll files
 

#43369 21/08/03 06:38 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
We cannot write a script for you however, best place to start would be..

/help Sockets
/help /sockwrite
/help /sockaccept
/help /sockopen
/help /sockclose
/help /sockmark
/help /socklis
/help /sockrename

and the events..

on SOCKCLOSE
on SOCKOPEN
on SOCKLISTEN
on SOCKREAD
on SOCKWRITE


As for the buttons, I assume you meant dialogs..
Code:
dialog updates.script {
  title "Updates script!"
  size -1 -1 110 100
  option dbu
  button  "Get updates!", 1, 30 50 50 24, ok tab 1
}

on 1:dialog:updates.script:sclick:1: {
  /help Sockets
}

on 1:dialog:updates.script:init:*: {
  echo -a What commands you want to perform before dialog opens
}

For more information

/help Dialogs
/help on Dialog
/help /Did
/help /Didtok


I hope this helps you in some way. grin

#43370 21/08/03 06:42 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You need to use sockets to read from a website.
Look at my first post..
There are some great tutorials Here, Here and Here.

#43371 21/08/03 07:14 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
is there any other way of doing this or does it have to be done my sockets

#43372 21/08/03 07:23 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
dont get me wrong you need to learn sockets but mess with this:
Code:

on 1:SOCKOPEN:ver: {
  if ($sockerr > 0) return
  sockwrite -n $sockname GET /version.txt HTTP/1.1
  sockwrite -n $sockname Host: host.com
  sockwrite -n $sockname Connection: keep-alive
  sockwrite $sockname $crlf
  if ($isFile(data.txt)) .remote data.txt
}
on 1:SOCKREAD:ver: {
  sockread -f &data
  bwrite data.txt -1 -1 &data
  ; speeds up things so we dont have to wait for the socket to close..
  .timerver 1 1 siver.close
}
alias ver.close {
  if ($isFile(data.txt)) {
    var %lastline = $read(data.txt, $lines(data.txt))
    .remove data.txt
  }
  else var %lastline = Could not download file.
  did -ra versioncheck 1 %lastline
}
alias checkver { sockopen ver host.com 80 }


_________
may death strike you.
#43373 21/08/03 07:41 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
I think I am starting to get this but how would i go about starting this code would I open the socket to my hosting server or is there some othere way to start it

#43374 21/08/03 07:43 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
yeah change the info..... BE SURE TO LEAVE SLASHES AS THEY ARE NOW!!!!!!!!!!!!

and type /checkver

if u need more help, its all customized
Code:
alias checkver { sockopen ver area51script.fairmount.nu 80 }
on 1:SOCKOPEN:ver: {
  if ($sockerr > 0) return
  sockwrite -n $sockname GET /update.txt HTTP/1.1
  sockwrite -n $sockname Host: area51script.fairmount.nu
  sockwrite -n $sockname Connection: keep-alive
  sockwrite $sockname $crlf
  if ($isFile(data.txt)) .remote data.txt
}
on 1:SOCKREAD:ver: {
  sockread -f &data
  bwrite data.txt -1 -1 &data
  ; speeds up things so we dont have to wait for the socket to close..
  .timerver 1 1 siver.close
}
alias ver.close {
  if ($isFile(data.txt)) {
    var %lastline = $read(data.txt, $lines(data.txt))
    .remove data.txt
  }
  else var %lastline = Could not download file.
  did -ra versioncheck 1 %lastline
}


_________
may death strike you.
#43375 21/08/03 07:55 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
i keep getting this error

/did: invalid parameters (line 35, errormsgs)

here is the code that i have copyed and changed what did I do wrong


Code:
 
on 1:SOCKREAD:update: {
  sockread -f &data
  bwrite update.txt -1 -1 &data  
  ; speeds up things so we dont have to wait for the socket to close..  
  .timerver 1 1 update.close
}
alias update.close {
  if ($isFile(update.txt)) {
    var %lastline = $read(update.txt, $lines(update.txt))
    .remove update.txt
  } 
  else update %lastline = Could not download file.
  did -ra versioncheck 1 %lastline
}
alias checkver { sockopen update host.com 80 }

 

#43376 21/08/03 07:57 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
you have to customise the did -ra versioncheck 1 statement

you butchered the code, use the last example i gave you and just change the did part


_________
may death strike you.
#43377 21/08/03 08:38 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
ok I am very new to sockets but what am I to change in the did part to?

#43378 21/08/03 08:50 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
post the dialog your using


_________
may death strike you.
#43379 21/08/03 09:10 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
Code:
 

dialog update {
  title Update Panel
  size -1 -1 400 500

  button "Ok" ,1, 0 475 75 25,ok
  button "Clear" ,3, 75 475 75 25

  Edit "" ,2, 5 3 390 470,read,multi
}

 

#43380 21/08/03 09:11 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
If your dialog is called update, why are you trying to use /did on a dialog called versioncheck?

#43381 21/08/03 09:16 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
hes not


new username: tidy_trax
#43382 21/08/03 09:22 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
this things is still not working I think I give up on it I will come back to it later thanks for all the help from everybody

#43383 21/08/03 09:23 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
make sure the dialog is opened first!!!!
Code:
alias checkver { sockopen ver area51script.fairmount.nu 80 }
on 1:SOCKOPEN:ver: {
  if ($sockerr > 0) return
  sockwrite -n $sockname GET /update.txt HTTP/1.1
  sockwrite -n $sockname Host: area51script.fairmount.nu
  sockwrite -n $sockname Connection: keep-alive
  sockwrite $sockname $crlf
  if ($isFile(data.txt)) .remote data.txt
}
on 1:SOCKREAD:ver: {
  sockread -f &data
  bwrite data.txt -1 -1 &data
  ; speeds up things so we dont have to wait for the socket to close..
  .timerver 1 1 siver.close
}
alias ver.close {
  if ($isFile(data.txt)) {
    var %lastline = $read(data.txt, $lines(data.txt))
    .remove data.txt
  }
  else var %lastline = Could not download file.
  did -ra update 2 %lastline
}


_________
may death strike you.
#43384 21/08/03 09:25 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
yes he is ... read the code

did -ra versioncheck 1 %lastline

somethings not kosher there


D3m0nnet.com
#43385 21/08/03 09:26 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
this person doesnt seem to have much experience in scriping(sorry if i thought wrong), so please remove the [code ] and [/code ] tags, as they cause an odd problem with the lines and brackets.


new username: tidy_trax
#43386 21/08/03 09:27 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Quote:
alias ver.close { if ($isFile(data.txt)) { var %lastline = $read(data.txt, $lines(data.txt)) .remove data.txt } else var %lastline = Could not download file. did -ra versioncheck 1 %lastline}

he was using her script, and he obviously(again, sorry if im wrong) doesnt have much experience with scripting or maybe just dialogs.


new username: tidy_trax
#43387 21/08/03 09:30 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
dialog update { title Update Panel size -1 -1 400 500 button "Ok" ,1, 0 475 75 25,ok button "Clear" ,3, 75 475 75 25 Edit "" ,2, 5 3 390 470,read,multi}

ok look at the name of that dialog? it is infact called UPDATE not VERSIONCHECK thats why it is posting that error ..... there is NO dialog named VERSIONCHECK why is that so hard to understand for u?


D3m0nnet.com
#43388 21/08/03 09:32 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
that isnt hard to understand for me, but like i said: if he doesnt have much experience with dialogs then how do you expect him to correct that error, codemaster's right you are rude, you posted that before you even knew what i was talking about.


new username: tidy_trax
#43389 21/08/03 09:36 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
no I don't know alot about scripting but i am trying to learn and i did open the update dialog and it still did not work here is what i have in the romte file

dialog update {
title Update Panel
size -1 -1 400 500

button "Ok" ,1, 0 475 75 25,ok
button "Clear" ,3, 75 475 75 25

Edit "" ,2, 5 3 390 470,read,multi
}
alias checkver { sockopen ver area51script.fairmount.nu 80 }
on 1:SOCKOPEN:ver: {
if ($sockerr > 0) return
sockwrite -n $sockname GET /update.txt HTTP/1.1
sockwrite -n $sockname Host: area51script.fairmount.nu
sockwrite -n $sockname Connection: keep-alive
sockwrite $sockname $crlf if ($isFile(data.txt))
.remote data.txt
}
on 1:SOCKREAD:ver: {
sockread -f &data
bwrite data.txt -1 -1 &data
; speeds up things so we dont have to wait for the socket to close..
.timerver 1 1 siver.close
}
alias ver.close {
if ($isFile(data.txt)) {
var %lastline = $read(data.txt, $lines(data.txt))
.remove data.txt
}
else var %lastline = Could not download file.
did -ra update 2 %lastline
}



and here is what it shows when I type /socklist *

* Open sockets:
-
update 66.139.78.173:80 tcp active (on: 63.189.64.72 4294)

#43390 21/08/03 09:38 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
wah pity party for u. no the fact is u didnt read what i was saying ..... i was telling u that even tho he was using someones code the error he was getting was because of a bad dialog name ... now if me pointing out to somone something u over looked is me being rude well i cant help that. I am sure tho u will get over it.


D3m0nnet.com
#43391 21/08/03 09:39 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
who's "she"?


_________
may death strike you.
#43392 21/08/03 09:43 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
where is the alias for this?

.timerver 1 1 siver.close

i see one called ver.close but not siver.close?


D3m0nnet.com
#43393 21/08/03 09:45 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
thats my mistake... sorry


_________
may death strike you.
#43394 21/08/03 09:45 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
my reply:
Quote:
he was using her script, and he obviously(again, sorry if im wrong) doesnt have much experience with scripting or maybe just dialogs.

your reply:
Quote:
dialog update { title Update Panel size -1 -1 400 500 button "Ok" ,1, 0 475 75 25,ok button "Clear" ,3, 75 475 75 25 Edit "" ,2, 5 3 390 470,read,multi}

ok look at the name of that dialog? it is infact called UPDATE not VERSIONCHECK thats why it is posting that error ..... there is NO dialog named VERSIONCHECK why is that so hard to understand for u?


since when i did i say i couldnt understand it?
k, i read your post wrong, sorry for it being a crime frown, but why did you feel the need to type: why is that so hard to understand for u?
?


new username: tidy_trax
#43395 21/08/03 09:48 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
oh np at all .. im just tryin to figure out where the error is so that the poster can get something working ...


D3m0nnet.com
#43396 21/08/03 09:51 PM
Joined: Aug 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Aug 2003
Posts: 148
Here ya go, should work great
Code:
dialog update {
title Update Panel
size -1 -1 400 500

button "Ok" ,1, 0 475 75 25,ok
button "Clear" ,3, 75 475 75 25

Edit "" ,2, 5 3 390 470,read,multi
}
alias checkver { sockopen ver area51script.fairmount.nu 80 }
on 1:SOCKOPEN:ver: {
if ($sockerr > 0) return 
sockwrite -n $sockname GET /update.txt HTTP/1.1 
sockwrite -n $sockname Host: area51script.fairmount.nu 
sockwrite -n $sockname Connection: keep-alive 
sockwrite $sockname $crlf if ($isFile(data.txt)) 
.remote data.txt
}
on 1:SOCKREAD:ver: {
sockread -f &data
bwrite data.txt -1 -1 &data
; speeds up things so we dont have to wait for the socket to close..
.timerver 1 1 ver.close
}
alias ver.close {
if ($isFile(data.txt)) {
var %lastline = $read(data.txt, $lines(data.txt))
.remove data.txt
} 
else var %lastline = Could not download file.
if ($dialog(update)) { did -ra update 2 %lastline }
else { dialog -m update update | did -ra update 2 %lastline }
}


_________
may death strike you.
#43397 21/08/03 10:08 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
still nothing I even install a new copy of mirc na dtryied it in there and still nothing

#43398 21/08/03 10:20 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
ok try this one ... i got it to work ... it had a couple typos in it i cleared up

dialog update {
title Update Panel
size -1 -1 400 500
button "Ok" ,1, 0 475 75 25,ok
button "Clear" ,3, 75 475 75 25
Edit "" ,2, 5 3 390 470,read,multi
}
alias checkver { sockopen ver area51script.fairmount.nu 80 }
on 1:SOCKOPEN:ver: {
if ($sockerr > 0) return
sockwrite -n $sockname GET /update.txt HTTP/1.1
sockwrite -n $sockname Host: area51script.fairmount.nu
sockwrite -n $sockname Connection: keep-alive
sockwrite $sockname $crlf if ($isFile(data.txt))
.remove data.txt
}
on 1:SOCKREAD:ver: {
sockread -f &data
bwrite data.txt -1 -1 &data
; speeds up things so we dont have to wait for the socket to close..
timerver 1 1 ver.close
}
alias ver.close {
if ($isFile(data.txt)) {
var %lastline = $read(data.txt, $lines(data.txt))
.remove data.txt
}
else var %lastline = Could not download file.
echo -a %lastline
if ($dialog(update)) { did -ra update 2 %lastline }
else { dialog -m update update | echo -a %lastline | did -ra update 2 %lastline }
}


***** make sure u type /remote on .. as the version of this u were testing turned your remotes off due to one of the typos ..... anyhow hope this works for u now

Last edited by _D3m0n_; 21/08/03 10:22 PM.

D3m0nnet.com
#43399 21/08/03 10:31 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
I must be doing something wrong how woul di start this up should I open the update dialog frist or should i open the scoket frist? or is there something else

#43400 21/08/03 10:35 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
just type /checkver in any open window and hit enter make sure u do type /remote on before this because the other script pasted before disabled it


D3m0nnet.com
#43401 21/08/03 10:54 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
thanks everybody it works grin grin grin

#43402 21/08/03 11:03 PM
Joined: Aug 2003
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Aug 2003
Posts: 21
I don't know what I did worng but I went to chage the update.txt on my hosting site and when I went back and run the script again it gave me this


* Timer ver activated
-
* /echo: insufficient parameters (line 29, errormsgs)
-
* Timer ver halted
-

#43403 22/08/03 03:46 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I just read all that, and all i have to say is holy crap.

Everyone gets mad for posting untested code, and I had to have seen 10 version of code "well try this one.." "Ohh, well you need to do this one..." "This should work.."

*sigh*


-KingTomato
Page 1 of 2 1 2

Link Copied to Clipboard