mIRC Home    About    Download    Register    News    Help

Print Thread
#105555 17/12/04 05:01 PM
Joined: Nov 2004
Posts: 84
GogetaX Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2004
Posts: 84
how to write this:

if (%Variable EXIST) { ... }

what do i need to write that can show me if it exist?


by the time you finish reading this, you realize you have wasted 5 secundes of your life!
#105556 17/12/04 05:21 PM
Joined: Dec 2004
Posts: 81
N
Babel fish
Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
The below statement checks if %variable exists
if (%variable) { do something }

Last edited by nycdiesel; 17/12/04 05:22 PM.
#105557 17/12/04 05:41 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That is incorrect. Your statement checks if %variable contains a value different from 0, $null, or $false.

To see if a variable exists, use $var.

/help $var

Greets


Gone.
#105558 17/12/04 05:57 PM
Joined: Nov 2004
Posts: 84
GogetaX Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2004
Posts: 84
i have some BUG...

here is my code:

Code:
 
alias 1 {
  set %BoT.Q Write HA
  set %BoT.AA HA
  set %BoT.Q2 1
  set %BoT.QQ 1
  msg $chan 4-------------------------------------
  msg $chan 11 $+ %BoT.Q
  msg $chan 8 $+ $replacecs(%BoT.AA,A,*,B,*,C,*,D,*,E,*,F,*,G,*,H,*,I,*,J,*,K,*,L,*,M,*,N,*,O,*,P,*,Q,*,R,*,S,*,T,*,U,*,V,*,W,*,X,*,Y,*,Z,*,a,*,b,*,c,*,d,*,e,*,f,*,g,*,h,*,i,*,j,*,k,*,l,*,m,*,n,*,o,*,p,*,q,*,r,*,s,*,t,*,u,*,v,*,w,*,x,*,y,*,z,*)
  msg $chan 4-------------------------------------
  set %BoT.A %BoT.AA
}
on *:TEXT:%BoT.A:#onlineinfo:{ if ( %BoT.Q2 == %BoT.QQ ) {
    if ( %BoT.Winn. [ $+ [ $nick ] ] ) {
      set %BoT.Winn. [ $+ [ $nick ] ]  %BoT.Winn. [ $+ [ $nick ] ] + 1
      msg $chan 8Right$nick $+ ! you have answered on %BoT.Winn. [ $+ [ $nick ] ] Question(s)
      unset %BoT.A
    }
    else {
      %BoT.Winn. [ $+ [ $nick ] ] 1
      msg $chan 8Pravelno $nick $+ ! you have answered on %BoT.Winn. [ $+ [ $nick ] ] Question(s)
      unset %BoT.A
    }
  }
}


and when someone writing HA its doing all the alias 1


by the time you finish reading this, you realize you have wasted 5 secundes of your life!
#105559 17/12/04 06:34 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
What exactly is the bug?

I optimized your code a little bit.

Then i did the following:

/1 which outputted:

-------------------------------------
Write HA
**
-------------------------------------

Then my test nick said "ha" in the channel, and this appeared:

--> Pravelno testnick! you have answered on 1 Question

Then with my own nick i did /1 again, and let my other nick type "ha" again, and this was the output:

--> Right testnick! you have answered on 2 Questions

What exactly doesn't work like you intend it to?

Code:
on *:TEXT:%BoT.A::#onlineinfo:{
  if (%BoT.Q2 == %BoT.QQ) {
    inc %BoT.Winn. $+ $nick 
    if (%BoT.Winn. [ $+ [ $nick ] ] > 1) { 
      msg $chan 8Right $nick $+ ! you have answered on $v1 Questions 
    }
    else msg $chan 8Pravelno $nick $+ ! you have answered on 1 Question 
    unset %BoT.A  
  }
}
 [color:red]  [/color] 
alias 1 {
  set %BoT.Q Write HA
  set %BoT.AA HA
  set %BoT.Q2 1
  set %BoT.QQ 1
  msg $chan 4-------------------------------------
  msg $chan 11 $+ %BoT.Q
  msg $chan 8 $+ $putchar(%BoT.AA,*)
  msg $chan 4-------------------------------------
  set %BoT.A %BoT.AA
}
 [color:red]  [/color] 
alias putchar var %a, %b = $regsub($$1,/[a-z]/Sig,$replace($2,\,\\,$,\$),%a) | return %a


Gone.
#105560 17/12/04 06:45 PM
Joined: Nov 2004
Posts: 84
GogetaX Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2004
Posts: 84
i dont know, it still not working...

when TESTNICK will answer on first his question, the BoT will write this: right TESTNICK! u have answered on your 1st question!
if the TESTNICK is exist in variables (he have answered not on only one quesrtion)
then it will write the number of times that he have answered rightly...


by the time you finish reading this, you realize you have wasted 5 secundes of your life!
#105561 17/12/04 06:58 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You still haven't said what exactly isn't working as you want it to work.

It's obviously not working the way you want it, but how can it if you don't say exactly what should happen in what condition.

Try to elaborate as much as you can.


Gone.
#105562 17/12/04 07:11 PM
Joined: Nov 2004
Posts: 84
GogetaX Offline OP
Babel fish
OP Offline
Babel fish
Joined: Nov 2004
Posts: 84
that what г have gave to me, it dont working at all... (i dont know why)

i need, when i typing /1 then will run a question thing...
and if some1 will answer on the question (on the channel)
will get 1 POINT (the point is just number)
every time that some1 will answer right, the point will be bigger (+1) all the time

that is all...


by the time you finish reading this, you realize you have wasted 5 secundes of your life!
#105563 17/12/04 07:17 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Sounds like you just want a basic trivia bot, check here.

Greets


Gone.

Link Copied to Clipboard