Mirc Scripting


Horscht

Banned?
Joined
Jan 5, 2004
Messages
1,612
Age
38
Location
Germany
Website
Visit site
Hi

I downloaded this script, which echoes whatever is played in my Xbox Media Center (script will be attached at the end). Currently I have to name a channel where it should echo to, and whenever I type /gog, it'll echo what is playing in the defined channel. What do I have to change to not need to assign a chan first, but to simply type /gog and get the script to echo in the chan I am typing it? If you could tell me which line to edit, i would be very thankfull

tia

Horscht

Code:
##########################################
# Use/Edit this at your own risk         #
# Thanks to Xomp for Idea/Testing/Layout #
# Thanks to Vic10us for http syntax help #
# Thanks to all the people who helped    #
# contact me at zool@dead-blood.com      #
# or on efnet as GiZmoe in #evolutionx   #
##########################################

alias gog { sockopen zool %gip 80 }
on *:sockopen:zool:{
  sockwrite -n $sockname GET /xbmcCmds/xbmcHttp?command=getcurrentlyplaying HTTP/1.1
  sockwrite -n $sockname Host: %gip $+ $crlf $+ $crlf
}
on *:sockopen:zool2:{
  sockwrite -n $sockname GET /xbmcCmds/xbmcHttp?command=GetTagFromFileName&parameter= $+ %file HTTP/1.1
  sockwrite -n $sockname Host: %gip $+ $crlf $+ $crlf
}

on *:sockread:zool:{
  if ($sockerr) { echo -a Error | halt }
  else {
    var %temp
    sockread %temp
    if (%temp != $null) { write -c temp.txt %temp | if ( [li] isin $read(temp.txt,1)) { gstyle $read(temp.txt,1) } }
  }
}
on *:sockread:zool2:{
  if ($sockerr) { echo -a Error | halt }
  else {
    var %temp
    sockread %temp
    if (%temp != $null) { write -c temp.txt %temp | if ( [li] isin $read(temp.txt,1)) { gstyle $read(temp.txt,1) } }
  }
}
on 1:load:{ set %gip $$?="XBox's Ip" | /set %gchan $$?="Channel to display(Leave blank just to echo)" }
alias gstyle {
  if ([li]Filename isin $1-) { set %file1 $remove($1-,[li]Filename:) | set %file $remove($replace(%file1,$chr(32),'%20'),') | sockopen zool2 %gip 80 }
  if ([li]Duration isin $1-) { set %time1 $remove($1-,[li]Duration:) | set %time $asctime(%time1,n:ss) }
  if ([li]Time isin $1-) { set %curr $remove($1-,[li]Time:) | set %curr1 $calc($gettok(%curr,2,58) + $calc($gettok(%curr,-2,58) * 60)) }
  if ([li]Artist isin $1-) { set %art $remove($1-,[li]Artist:) }
  if ([li]Title isin $1-) { set %title $remove($1-,[li]Title:) }

  if ([li]Release isin $1-) { gecho }
}
alias gecho {
  set %info [7XBMC] • [ $+ %art $+ $chr(32) $+ ¤ $chr(32) $+  $+ %title $+ ] • ( $+ %curr $+ / $+ %time $+ ) •7GIZmoep3•
  if (%gchan != $null) { msg %gchan %info }
  if (%gchan == $null) { echo -a %info }
  if (%ga == 1) { set %ping $calc((%time1 - %curr1) + 3) | .timerzool 1 %ping /gog  }
  unset %file %file1 %curr %curr1 %time1 %time %art %title %ping
}
Menu channel {
  -
  XBMC GiZmoep3
  .Start Announce:/gog
  .Auto ReAnnounce
  ..On:/set %ga 1
  ..Off:/set %ga 0
  ..Stop Announce:.timerzool off
  .Other
  ..Change Ip:/set %gip $$?="XBox's Ip"
  ..Change Channel:/set %gchan $$?="Channel to display(Leave blank just to echo)"
  -
}
 
Last edited by a moderator:
Just create a new alias like this:

Code:
/gohere /gog #

(Substitute /gohere with whatever you find convenient to type)
 
hm.......

wouldn't this just keep it the same? Cause the script is currently set up to only echo to the chan i define first. The script echoes every time i type /gog but only to that channel and always to that channel. I would like to get the script to echo in the chan I currently am, and ONLY there. And visible for everyone.

Sorry if i am wrong here, if I am, i didn't get the point of aliases

EDIT:
Jup, as I thought. I think the problem is, that I didn't explain it corectly enough. Your method works, if my goal was to get the script echoe to me which it already does by default (the script echoes to me only, if no chan is defined). I want it to echoe to the chan I am currently in though, so everyone in the chan can see it.

thank you for your help, though.

EDIT2:
Would it work if i changed the line
Code:
if (%gchan == $null) { echo -a %info }

to

Code:
if (%gchan == $null) { say $chan %info }
?
 
Back
Top