|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
I have this script: ; **********************
; CSP by Smc_S
; **********************
;
;######### DDE related stuff v1.2 ##########
;############# Remote script ###############
on 1:LOAD:{
/load -a scripts/customdde.mrc
/set %ddeservname alienDDE
/set %ddewinyn on
/set %saydde off
/set %reactdde on
/set %ddertext !song
/set %mp3sendyn on
/set %mp3sendtrig !sendsong
/echo DDEwindow script loaded
}
on *:START:{
/ddeserver on %ddeservname
/ddewin
}
on 1:TEXT:%mp3sendtrig:#:{
if %mp3sendyn == on {
if %wanow != nothing {
var %check = $readini(ini\songs.ini,%wafile,$user)
if (%check != true) {
writeini -n ini\songs.ini %wafile $user true
/dcc send $nick %wafile
}
}
}
}
on 1:TEXT:%ddertext:#:{
if %reactdde == on {
/msg $chan I'm now listening to %wanow ( %watime ) $ismp3send
}
}
on 1:TEXT:!list:#:{
if %reactdde == on {
if %wanow != nothing {
/notice $nick Type %ddertext to see what I'm currently playing in Winamp
}
}
}
on 1:KEYDOWN:@DDE.Input:90,88,67,86,66:{
if ($keychar == z) /dde winamp_c prev
if ($keychar == x) /dde winamp_c play
if ($keychar == c) /dde winamp_c pause
if ($keychar == v) /dde winamp_c stop
if ($keychar == b) /dde winamp_c next
}
menu status {
-
DDE Window
.$enabledy(%ddewinyn) Enable:/ddewinon
.$enabledn(%ddewinyn) Disable:/ddewinoff
.-
.Rename Server:/dderename
}
As you can see i've tried to put an anti flood ting into the sending of the songs, but it doesn't quite work properly, when i take a look at the ini file i see: [C:\Documents] and=Settings\Rowan\My Documents\My Music\11 Highway Song.wma true
How can i get it so that it only checks the music filename and not the whole path, and it has the music file name as the part in the square brackts ([])? then the user on a line under it then an equals sign then true. and after the song is sent it sets it to false, or is there a better way of doing it?
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
|
|
|
|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
The script still makes INI file like this: Thats because the file name has a space, so how would you remove it so that it recognizes the space or gets rid of the space? Here is the current part of the script: on 1:TEXT:%mp3sendtrig:#:{
if %mp3sendyn == on {
if %wanow != nothing {
var %file = $nopath(%wafile)
var %check = $readini(ini\songs.ini,%file,$user)
if (%check != true) {
writeini -n ini\songs.ini %file $user true
/dcc send $nick %wafile
}
}
}
}
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
The bigger problem with your code is that you need to enclose the filename/dirname in quotes in order to have the full filename (or path) as the section in the ini file (due to spaces in files/paths). Change:
writeini -n ini\songs.ini %file $user true
To:
writeini -n ini\songs.ini " $+ %file $+ " $user true In this case, it is better to use individual $+ instances rather than using $+(), to avoid any problems caused by comma's in filenames or path's Edit: we posted at the same time, but this answers your question. Updated to reflect your changes.
Last edited by Om3n; 11/09/05 10:21 AM.
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
I replaced it with your code, but i keep getting this error: * /writeini: insufficient parameters (line 31, ddescript.mrc) I even tried this (adding a /) and nothing: on 1:TEXT:%mp3sendtrig:#:{
if %mp3sendyn == on {
if %wanow != nothing {
var %file = $nopath(%wafile)
var %check = $readini(ini\songs.ini,%file,$user)
if (%check != true) {
/writeini -n ini\songs.ini " $+ %file $+ " $user true
/dcc send $nick %wafile
}
}
}
}
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
Ah, i guess i completely overlooked the other coding mistake because i simply assumed the rest of the code was correct, there is no such identifier as $user, i think what you are looking for is $nick. on 1:TEXT:%mp3sendtrig:#:{
if %mp3sendyn == on {
if %wanow != nothing {
var %file = $nopath(%wafile)
var %check = $readini(ini\songs.ini,%file,[color:red]$nick[/color])
if (%check != true) {
/writeini -n ini\songs.ini " $+ %file $+ " [color:red]$nick[/color] true
/dcc send $nick %wafile
}
}
}
}
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
Joined: Aug 2005
Posts: 32
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 32 |
Thanks for that, i got that part working, but changed the coding some more to: on 1:TEXT:%mp3sendtrig:#:{
if %mp3sendyn == on {
if %wanow != nothing {
var %file = $nopath(%wafile)
var %time2 = $ctime - 60
var %check = $readini(ini\songs.ini,%file,$nick)
if (%check !<= %time2) {
var %time = $ctime
/writeini -n ini\songs.ini " $+ %file $+ " $nick %time
/dcc send $nick %wafile
}
}
}
} Yet, that doesn't work at all!  Any ideas? It's designed to let a user download the same file as long as it has been 1 Minute.
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
on 1:TEXT:%mp3sendtrig:#:{
if %mp3sendyn == on {
if %wanow != nothing {
var %file = $nopath(%wafile)
var %check = $readini(ini\songs.ini,%file,$nick)
if (%check != true) {
/writeini -n ini\songs.ini " $+ %file $+ " $nick true
/dcc send $nick %wafile
[color:red]/timer -o 1 60 /writeini -n ini\songs.ini " $+ %file $+ " $nick false[/color]
}
}
}
} This will change the setting in the ini to false after 60 seconds, letting the user get it again after this time. Notes about your changes, setting two variables using ctime and ctime - 60 is useless, if you had compared them for any reason the result would always be exactly the time. !<= is incorrect, the opposite of 'less-than-or-equal-to' (<=) is 'larger-than' (>). Plus in that particular if statement, %check would be a string and %time2 would be an integer, such a comparison using math operators is not possible.
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
|