mIRC Home    About    Download    Register    News    Help

Print Thread
#99335 30/09/04 11:13 PM
Joined: Sep 2004
Posts: 85
G
Babel fish
OP Offline
Babel fish
G
Joined: Sep 2004
Posts: 85
how can i store data where if someone types, -count 72 4536, it stores that in a database, and if someone types -event 72, it reads back whatever is in the database?, i'm not very good at scripting, and i just started to learn variables

#99336 01/10/04 12:02 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I think this is what you want:

Code:
on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) { hadd -m count $2- }
  elseif ($1 == -event) && ($hget(count,$2)) { msg $nick $hget(count,$2) }
}
on *:start:{
  if ($isfile(count.hsh)) { 
    if ($hget(count)) { 
      hsave -o count count.hsh 
      hfree count
    }
    hload count count.hsh
  }
}
on *:exit:{
  if ($hget(count)) { hsave -o count count.hsh }
}


New username: hixxy
#99337 01/10/04 12:17 AM
Joined: Sep 2004
Posts: 85
G
Babel fish
OP Offline
Babel fish
G
Joined: Sep 2004
Posts: 85
ok, thats a start, now, how would i make it so people cant add more then 20 to the current number?, like if the current number is 4500, they cant do -count 72 4521(or anything higher)

ok, i need some help on this too, can you use 2 elseif statements??, if not, should i make another trigger for this?


Code:
 on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) { hadd -m count $2- }
elseif ($1 == -walk) && ($2 isnum) { hadd -m walk $2- } {msg $nick Last Walk on $2 is $hget(walk,$2) }
elseif ($1 == -event) && ($hget(count,$2)) && ($hget(walk,$2)) {msg $nick Current Count on $2 is $hget(count,$2) }
} 


nvm, i got that working, now plz help set up a limit so no more then 10 counts can be added(like you cant do -count 4563 if the previous count was 4552)

Last edited by Gameaddix; 01/10/04 12:37 AM.
#99338 01/10/04 12:40 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 20))) { hadd -m count $2- }
  elseif ($1 == -walk) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 20))) { hadd -m walk $2- | msg $nick Last Walk on $2 is $hget(walk,$2) }
  elseif ($1 == -event) && ($hget(count,$2)) && ($hget(walk,$2)) { msg $nick Current Count on $2 is $hget(count,$2) }
} 


New username: hixxy
#99339 01/10/04 01:08 AM
Joined: Sep 2004
Posts: 85
G
Babel fish
OP Offline
Babel fish
G
Joined: Sep 2004
Posts: 85
ok, all the -count, -walk, -event commands working.....now, think u can help me get it to change the topic, lets say, someone uses the -count 72 1452, then -count 72 1455, it will make the topic say "Standby: 72", and if someone uses -count 72 3 more times after that, it makes the topic say "Active: 72", and takes it off of "Standby:", and 3 more -count's make it go from "Active:" to "Hot: 72", and if it doesnt have any -count commands on it, it removes 72 altogether from the topic.
also, this is what i got, and whenever i do -count, -walk, or -master, it gives me: "Last Walk on 65 is 60" i cant figure out why
Code:
on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) { hadd -m count $2- }
  elseif ($1 == -walk) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) { hadd -m walk $2- }
  elseif ($1 == -event) && ($hget(count,$2)) && ($hget(walk,$2)) { msg $nick Current Count on $2 is $hget(count,$2) } | { msg $nick Last Walk on $2 is $hget(walk,$2) }
}

on 10:test:-*:#:{
  if ($1 == -master) && ($2 isnum) { hadd -m count $2- }
}
  

Last edited by Gameaddix; 01/10/04 01:12 AM.
#99340 01/10/04 01:20 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) {
    inc %count $+ $chan
    if ($eval(% $+ count $+ $chan,2) == 2) { topic $chan standby: $2 }
    elseif ($eval(% $+ count $+ $chan,2) == 5) { topic $chan active: $2 }
    elseif ($eval(% $+ count $+ $chan,2) == 8) { topic $chan hot: $2 }
    hadd -m count $2- 
  }
  elseif ($1 == -walk) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) { 
    hadd -m walk $2- 
    msg $nick Last Walk on $2 is $hget(walk,$2) 
  }
  elseif ($1 == -event) && ($hget(count,$2)) && ($hget(walk,$2)) { msg $nick Current Count on $2 is $hget(count,$2) }
}



New username: hixxy
#99341 01/10/04 01:34 AM
Joined: Sep 2004
Posts: 85
G
Babel fish
OP Offline
Babel fish
G
Joined: Sep 2004
Posts: 85
thats the thing, it is messaging me a Last Walk, when i do -walk 72 7548, but i only want to msg me Last Walk when i do a -event 72, along with -count, also, could i have it add to the current topic, lets say the topic is "Hot: 17 Active: 72 Standby: ", and say i do "-count 65" 3 times, ti makes the topic "Hot: 17 Active: 72 Standby: 65"?

Last edited by Gameaddix; 01/10/04 01:47 AM.
#99342 01/10/04 02:00 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) {
    inc %count $+ $chan
    if ($eval(% $+ count $+ $chan,2) == 2) { topic $chan $remove($chan($chan).topic,standby: $2,active: $2,hot: $2) standby: $2 }
    elseif ($eval(% $+ count $+ $chan,2) == 5) { topic $chan $remove($chan($chan).topic,standby: $2,active: $2,hot: $2) active: $2 }
    elseif ($eval(% $+ count $+ $chan,2) == 8) { topic $chan $remove($chan($chan).topic,standby: $2,active: $2,hot: $2) hot: $2 }
    hadd -m count $2- 
  }
  elseif ($1 == -walk) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) { hadd -m walk $2- }
  elseif ($1 == -event) && ($hget(count,$2)) && ($hget(walk,$2)) { 
    msg $nick Current Count on $2 is $hget(count,$2) 
    msg $nick Last Walk on $2 is $hget(walk,$2)
  }
}



New username: hixxy
#99343 01/10/04 02:20 AM
Joined: Sep 2004
Posts: 85
G
Babel fish
OP Offline
Babel fish
G
Joined: Sep 2004
Posts: 85
ok, topic change works, but the -event doesnt, also, is there a way i could get it to add in mid topic, here is the topic:

««( HOT: ) ¬( ACTIVE: ) ¬( STANDBY: ) ¬( WALKED: ) ¬ Welcome to GameAddix.net Dclone! Tell your friends about us!

could i get it to add lets say 72 to standby, when it gets the -count's on 72, instead of adding it at the end?

#99344 01/10/04 10:24 AM
Joined: Sep 2004
Posts: 85
G
Babel fish
OP Offline
Babel fish
G
Joined: Sep 2004
Posts: 85
here is what i got,
Code:
on *:text:-*:#:{
  if ($1 == -count) && ($2 isnum) && ($3 isnum $+(1-,$calc($hget(count,$2) + 10))) { hadd -m count $2- 
    inc %count $+ $chan 
    if ($eval(% $+ count $+ $chan,2) == 2) { topic $chan $remove($chan($chan).topic,standby: $2,active: $2,hot: $2) standby: $2 }
    elseif ($eval(% $+ count $+ $chan,2) == 5) { topic $chan $remove($chan($chan).topic,standby: $2,active: $2,hot: $2) active: $2 }
    elseif ($eval(% $+ count $+ $chan,2) == 8) { topic $chan $remove($chan($chan).topic,standby: $2,active: $2,hot: $2) hot: $2 }
  }
  elseif ($1 == -walk) && ($2 isnum) { hadd -m walk $2- }
  elseif ($1 == -event) && ($hget(count,$2)) && ($hget(walk,$2)) { msg $nick Current Count on $2 is $hget(count,$2) } | { msg $nick Last Walk on $2 is $hget(walk,$2) }
} 
 

and for some reason, whenever i do -count, or -walk, it msg's me the last walk....i cant figure it out


Link Copied to Clipboard