mIRC Home    About    Download    Register    News    Help

Print Thread
#242314 03/07/13 03:41 PM
Joined: Jun 2013
Posts: 43
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jun 2013
Posts: 43
I'm having a bit of trouble with reading from an ini file with an 'on text' script. I have this in the Aliases section and works when i type '/commandtest 1' into the mIRC chat:

Code:
/commandtest { msg $chan $readini(file.ini,items,$1) }


The problem is when I try using an 'on text' script to call the command it doesn't seem to work, nothing comes up:

Code:
on *:text:!commandtest *:#:{
  commandtest $2- { msg $chan $readini(file.ini,items,$1) }
}


I also tried reading from the ini without using an alias but that didn't work either, I tried:

Code:
on *:text:!commandtest *:#:{
  msg $chan $readini(file.ini,items,$2-)
}


If anyone could help me I would really appreciate it, I'm probably doing something really stupid but I can't get it to work.
Many thanks, Tom.

GamingTom #242317 03/07/13 06:37 PM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
The correct format would be:
Code:
on *:TEXT:!commandtest *:#:{
  commandtest $2-
}

And $2 should be used instead of $2-... not? I don't think spaces are allowed in .ini items.

Remote scripts can also only be triggered by other users, in case you didn't know.

5618 #242318 03/07/13 06:45 PM
Joined: Jan 2004
Posts: 1,352
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,352
You should be using the n switch with $readini to prevent evaluation of the value $readini(file.ini,n,items,$1)

5618 #242319 03/07/13 06:57 PM
Joined: Jun 2013
Posts: 43
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jun 2013
Posts: 43
I have changed the script to what '5168' suggested but still doesn't work. My .ini file is set out like this:
Code:
[items]
1=This is an item.

but when I type in '!commandtest 1' the bot doesn't reply with 'This is an item'. I am using an external Twitch chat client to perform the command and I also put in the n switch suggested by Loki12583. I don't understand what I'm doing wrong...


Last edited by GamingTom; 03/07/13 06:58 PM.
5618 #242320 03/07/13 07:33 PM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Whoops, you need to pass the channel to your alias as well.
Code:
/commandtest { msg $2 $readini(file.ini,items,$1) }

on *:TEXT:!commandtest *:#: commandtest $2 $chan


5618 #242321 03/07/13 07:42 PM
Joined: Jun 2013
Posts: 43
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jun 2013
Posts: 43
I'm suspecting that you wrote the alias wrong because that would be sending a message to the channel '$2' which in this case is 'This'. But I changed the remote on text script but still nothing happens. If you have any other ideas I would greatly appreciate them.

-- Edit --
Never mind, I got it working in the end, I moved it to a separate script file and it seems to be working, many thanks for your help!

Last edited by GamingTom; 03/07/13 07:50 PM.

Link Copied to Clipboard