mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2014
Posts: 1
S
Mostly harmless
OP Offline
Mostly harmless
S
Joined: Feb 2014
Posts: 1
im trying to make a command to allow me to make more commands so far i have manege to make it add

on *:text: !trigger *:#: msg #stobbsie action

when i run the command with
!addcommand !trigger action
but i what it to say

on *:text:!trigger*:#: { msg $chan action }

but apparently { , } and $chan are reserved and cant be used any suggestions on how to fix this also how can i remove the space before and after !trigger this is the code im using


on *:text:!addcommand *:#: {
if ($2 == show) { msg $chan Commands avalible are !addcommand | return }
else {
write scripts\ilordcommands.txt on *:text: $2 *:$chan: { msg $chan $3- }
msg $chan done
}
}
}

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
*deleted*

Last edited by Crinul; 24/02/14 07:43 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Writing raw text and then loading it as a script is dangerous, instead you should just keep a list of commands and responses.

Code:
on $*:text:/^!addcommand !?(\S+)/iS:#:{
  writeini commands.ini commands $regml(1) $$3-
}

on $*:text:^!(\S+):#:{
  if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
}

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Dangerous? How? (It could stop working with too many on text)
Do you see the posts count on the OP? Do you expect him to understand your code? Or just use it?
You would have to explain in more detail.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
It's dangerous because it allows arbitrary code to be run which could compromise the entire system. I expect anyone using code provided on the forum to look up anything they don't recognize in the help files.

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Quote:
It's dangerous because it allows arbitrary code to be run which could compromise the entire system.


/write and /msg do not double evaluate content.

Am I missing something here?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: Crinul
/write and /msg do not double evaluate content.

Am I missing something here?


Presumably he is loading the file he writes to as a remote script. Otherwise why would he be writing events to it?

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Yes. Unless he adds them later (like feature suggestions file)
Still, no double evaluation.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: Crinul
Yes. Unless he adds them later (like feature suggestions file)
Still, no double evaluation.


I don't think his purpose is to implement a feature suggestion. It's to allow users to create new "commands" (in real time) which cause his bot to respond appropriately. Writing new events to a file is not the way to go about this. If you're writing user input to loaded scripts you've just compromised your system.

!addcommand !exploit $findfile(.,*,1,run notepad)
!addcommand !exploit exploited | run notepad

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Now I see.
It's the remotes that make it dangerous, not the write part.
I was thinking about the code only.

Thanks for the clarification, Loki12583.


Link Copied to Clipboard