|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
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
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2003
Posts: 21 |
here is what i tried and it does not work
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
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
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..
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.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2003
Posts: 21 |
is there any other way of doing this or does it have to be done my sockets
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
Vogon poet
Joined: Aug 2003
Posts: 148 |
dont get me wrong you need to learn sockets but mess with this:
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.
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
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
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
Vogon poet
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
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.
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
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
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 }
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
Vogon poet
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.
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2003
Posts: 21 |
ok I am very new to sockets but what am I to change in the did part to?
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
Vogon poet
Joined: Aug 2003
Posts: 148 |
post the dialog your using
_________ may death strike you.
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2003
Posts: 21 |
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
}
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
If your dialog is called update, why are you trying to use /did on a dialog called versioncheck?
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
Joined: May 2003
Posts: 2,265 |
new username: tidy_trax
|
|
|
|
Joined: Aug 2003
Posts: 21
Ameglian cow
|
OP
Ameglian cow
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
|
|
|
|
Joined: Aug 2003
Posts: 148
Vogon poet
|
Vogon poet
Joined: Aug 2003
Posts: 148 |
make sure the dialog is opened first!!!!
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.
|
|
|
|
Joined: Dec 2002
Posts: 1,527
Hoopy frood
|
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
|
|
|
|
Joined: May 2003
Posts: 2,265
Hoopy frood
|
Hoopy frood
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
|
|
|
|
|