mIRC Home    About    Download    Register    News    Help

Print Thread
Some help for noob. Creating a command. #251094 09/02/15 05:54 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
Hi guys.
I just tryed this program and it works well. So I made the simple commands for my personal twitch bot. Like !fb, !twitter etc. That gives a text after command in chat.
So i dont understand how can i make the following options:

  • !command <option> I need to put the <option> into a global variable, how can i do this?
  • How to create arrays(is it possible?).


I'll be very greatfull if someone can help me with my problems.
Thanks.

Last edited by FuryRang; 09/02/15 05:54 PM.
Re: Some help for noob. Creating a command. [Re: FuryRang] #251097 09/02/15 06:30 PM
Joined: Feb 2015
Posts: 18
E
EUDIS1980 Offline
Pikka bird
Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
Would be nice to explain more about how and what you want the <option> to be like. Is it about opening Twitter page, or posting to Twitter, or something else? Maybe you can post a few hypothetical commands you would type.

Re: Some help for noob. Creating a command. [Re: EUDIS1980] #251098 09/02/15 06:36 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
I need to do a simple counter.
Example:
user writting: !command string;
And i'm creating(if not exists) or inc() variable string as integer value;

Re: Some help for noob. Creating a command. [Re: FuryRang] #251103 09/02/15 07:28 PM
Joined: Feb 2015
Posts: 18
E
EUDIS1980 Offline
Pikka bird
Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
I'm afraid i still don't understand smirk

U want to count to a certain number? Like:
Input: !count 5
Output: 1, 2, 3, 4, 5

U want to count seconds elapsed?
Input: !count
Output: Seconds 5,4,3,2,1....

Btw, inc is a command, so u don't need () next to it smile

Re: Some help for noob. Creating a command. [Re: EUDIS1980] #251104 09/02/15 07:34 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
Nop, i want to count number of times which used !command with this <option>

Re: Some help for noob. Creating a command. [Re: FuryRang] #251106 09/02/15 07:59 PM
Joined: Feb 2015
Posts: 18
E
EUDIS1980 Offline
Pikka bird
Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
Code:
on *:text:!command *:#:{
  var %cmd = $gettok($1-,2-,32)
  set %command. $+ $remove(%cmd,$chr(32)) %cmd
}


!command take me to the stars

that would create a global variable %command.takemetothestars

Last edited by EUDIS1980; 09/02/15 08:00 PM.
Re: Some help for noob. Creating a command. [Re: EUDIS1980] #251107 09/02/15 08:06 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
Thanks, i'll try wink

How can I write the value into chat?

Last edited by FuryRang; 09/02/15 08:10 PM.
Re: Some help for noob. Creating a command. [Re: FuryRang] #251110 09/02/15 08:22 PM
Joined: Feb 2015
Posts: 18
E
EUDIS1980 Offline
Pikka bird
Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
/say %command.takemetothestars


And, since you originally wanted to count the times that was said:

Code:
on *:text:!command *:#:{
  var %cmd = $gettok($1-,2-,32)
  if (!%command. $+ $remove(%cmd,$chr(32))) {
    set %command. $+ $remove(%cmd,$chr(32)) %cmd
  }
  else {
    inc %command. $+ $remove(%cmd,$chr(32)) $+ .times
  }
}


In this case %command.takemetothestars holds the option,
and the %command.takemetothestars.times the number of times used.

Last edited by EUDIS1980; 09/02/15 08:22 PM.
Re: Some help for noob. Creating a command. [Re: EUDIS1980] #251128 10/02/15 12:27 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
Thanks mate, it works well)
All the counts are working, i got the variables with each value.
But when i'm trying to put the value of %command.<option>.times into chat, it's writing sth like this: <option>.times

Code:
on *:text:!command *:#:{
  var %cmd = $gettok($1-,2-,32)
  if (!%command. $+ $remove(%cmd,$chr(32))) {
    set %command. $+ $remove(%cmd,$chr(32)) %cmd
  }
  else {
    inc %command. $+ $remove(%cmd,$chr(32)) $+ .times
  }

  msg $chan %command. $+ $remove(%cmd,$chr(32)) $+ .times

}


Re: Some help for noob. Creating a command. [Re: FuryRang] #251129 10/02/15 01:51 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
Ah, and onemore question.
Is there foreach() or for(int %a=1){} function?

Re: Some help for noob. Creating a command. [Re: FuryRang] #251130 10/02/15 02:01 PM
Joined: Jan 2004
Posts: 1,275
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,275
No, you need to do everything through while loops.

Re: Some help for noob. Creating a command. [Re: Loki12583] #251131 10/02/15 02:10 PM
Joined: Feb 2015
Posts: 7
F
FuryRang Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2015
Posts: 7
Originally Posted By: Loki12583
No, you need to do everything through while loops.
Found that sleep
So, why command writning in chat <option>.times instead off value :C
In vars file all the values a created and increasing.

Re: Some help for noob. Creating a command. [Re: FuryRang] #251134 10/02/15 02:57 PM
Joined: Feb 2015
Posts: 18
E
EUDIS1980 Offline
Pikka bird
Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
Yes, u are right. It's because i forgot to use brackets. Haven't used dynamics for a long time hehe. It's also better to use $null instead of !


Code:
on *:text:!command *:#:{
  var %cmd = $gettok($1-,2-,32)
  if (%command. $+ $remove(%cmd,$chr(32)) == $null) {
    set %command. $+ $remove(%cmd,$chr(32)) %cmd
  }
  else {
    inc %command. $+ $remove(%cmd,$chr(32)) $+ .times
  }

  msg $chan %command. [ $+ [ $remove(%cmd,$chr(32)) $+ .times ] ]

}