mIRC Home    About    Download    Register    News    Help

Print Thread
[REQ] Timer script, socket read. #251635 26/02/15 09:08 AM
Joined: Dec 2014
Posts: 24
J
Jokke Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Dec 2014
Posts: 24
Hi lovely community!

I've been having trouble lately with this script, I got help to create it, using a command but I'm trying to get it timed so it will post the output in #gamerhuset each 30 minute.

Code:
menu channel {
  DagsTilbud
  .Start: .timerAnnounce. $+ $chan 0 10 set %chan #gamerhuset | sockopen gmr www.playgames.dk 80 | echo Dagstilbud startet.
  .Stop: .timerAnnounce. $+ $chan off | sockclose gmr | echo Dagstilbud stoppet.
}

on *:sockread:gmr: {
  var %data | sockread -f %data
  if (html isin %data) { 
    msg #gamerhuset Playgames.dk's dags tilbud kan du finde lige her! %data | sockclose $sockname
  }
}
on *:SockOpen:gmr: {  
  sockwrite -n $sockname GET /playtime.txt HTTP/1.1
  sockwrite -n $sockname Host: www.playgames.dk
  sockwrite -n $sockname
}



I don't have any idea what's going on, since in my eyes it should work. Please, I'm crying my eyes out since i feel like such a noob. Can some dear soul please help me?

Re: [REQ] Timer script, socket read. [Re: Jokke] #251636 26/02/15 09:25 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Try typing /timers in the editbox and see if you notice anything weird about it. (After you've initiated the script from the menu that is)

You have it hooked so that the timer will only set %chan, the other stuff aren't part of the timer.

Add all things you want to happen in an alias, then call the alias from the menu channel.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: [REQ] Timer script, socket read. [Re: Nillen] #251637 26/02/15 09:55 AM
Joined: Dec 2014
Posts: 24
J
Jokke Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Dec 2014
Posts: 24
Code:
alias tilbud {
  echo scriptet kaøsædlfj
  sockopen gmr www.playgames.dk 80
  sockread gmr
  msg #gamerhuset Playgames.dk's dags tilbud kan du finde lige her! %data
  echo Dagstilbud startet.
}
alias tilbudstop {
  sockclose $sockname
  echo Dagstilbud stoppet.
}
menu channel {
  DagsTilbud
  .Start: .timerAnnounce. $+ $chan 0 10 /tilbud
  .Stop: .timerAnnounce. $+ $chan off /tilbudstop
}

on *:sockread:gmr: {
  var %data | sockread -f %data
  if (html isin %data) { 
    msg #jokkebaby Kig forbi vores sponsors dagstilbud! %data | sockclose $sockname
  }
}
on *:SockOpen:gmr: {  
  sockwrite -n $sockname GET /playtime.txt HTTP/1.1
  sockwrite -n $sockname Host: www.playgames.dk
  sockwrite -n $sockname
}


I tried, but it still wont run. What do i do wrong? smirk

Re: [REQ] Timer script, socket read. [Re: Jokke] #251638 26/02/15 10:10 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Valiant effort. You did what I told you to, I should have explained better. You can't use $sockname in an alias event, as there is no sockname. But you don't need to either.
You can also not trigger /sockread in the alias event, but you need to wait for the on sockread event to occur after the sockopen event.

Take a look at the code I provide here.
Code:
alias tilbud {
  sockclose gmr
  echo Dagstilbud startet.
  sockopen gmr www.playgames.dk 80
}

menu channel {
  DagsTilbud
  .Start: .timerAnnounce. $+ $chan 0 10 tilbud
  .Stop: .timerAnnounce. $+ $chan off
}

on *:SockOpen:gmr: {  
  sockwrite -n $sockname GET /playtime.txt HTTP/1.1
  sockwrite -n $sockname Host: www.playgames.dk
  sockwrite -n $sockname
}

on *:sockread:gmr: {
  var %data 
  sockread -f %data
  if (html isin %data) msg #jokkebaby Kig forbi vores sponsors dagstilbud! %data
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net