mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2015
Posts: 7
F
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.
Joined: Feb 2015
Posts: 18
E
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.

Joined: Feb 2015
Posts: 7
F
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;

Joined: Feb 2015
Posts: 18
E
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

Joined: Feb 2015
Posts: 7
F
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>

Joined: Feb 2015
Posts: 18
E
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.
Joined: Feb 2015
Posts: 7
F
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.
Joined: Feb 2015
Posts: 18
E
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.
Joined: Feb 2015
Posts: 7
F
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

}


Joined: Feb 2015
Posts: 7
F
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?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
No, you need to do everything through while loops.

Joined: Feb 2015
Posts: 7
F
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.

Joined: Feb 2015
Posts: 18
E
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 ] ]

}


Link Copied to Clipboard