Friendcode tracker [slightly broken]

By KilllerX on Jul 11, 2013

I think more or less where it is broken in in my writeini sections. I don't think I have it quite right the way I want with making them to lower case characters, and making it to one word. Any advice would be helpful.

On *:TEXT:*:#:{
  if ($1 == !add) {
    if ($2 == FC) {
      if ($3 == help) {
        msg # Syntax: !add fc [Friend-Code-Numbers] [Game]  - Note: Don't worry about dashes.
      }
      else {
        if ($3 !isnum) { 
          msg # Syntax:  !add fc [Friend-Code-Numbers] [Game] - Note: No DASHES in the Friend Code.
        }
      }
      else {
        if (!$readini(freindcodes.ini,$nick,$lower($remove($4-,$chr(32))) {
          writeini friendcodes.ini $nick $lower($remove($4-,$chr(32))) $3
        }
      }
      else { 
        msg # You already have a Friend Code registered for that game. If it has changed due to restarting a game and you wish to change it type !change in the next 10 seconds
        set % [ $+ [$nick] ] $+ .friendcode $3
        set % [ $+ [$nick] ] $+ .game $lower($remove($4-,$chr(32)))
        write friendcodechange.txt -c $nick
        .timer.changefc 1 10
        write friendcodechange.txt -c $null
        unset % [ $+ [$nick] ] $+ .friendcode $3
        unset % [ $+ [$nick] ] $+ .game $lower($remove($4-,$chr(32)))
      }
    }
  }

  if ($2 == find) {
    if ($3 == help) {
      msg # Syntax: !find [Chat Nick] [Game Name]
    }
    else {
      if (!$readini(friendcodes.ini,$2,$lower($remove($3-,$chr(32))) {
        msg # either you misspelled the Chatters Nick, or they don't have a friend code for that game.
      }
      else {
        msg # $2 $+ 's Friend code for $3- is $readini(friendcodes.ini,$2,$lower($remove($3-,$chr(32)))
      }
    }
  }
}

on *:TEXT:!change:#:{
  if ($nick == $read(friendcodechange.txt,1) {
    writeini friendcodes.ini % [ $+ [$nick] ] $+ .game $lower($remove($4-,$chr(32))) % [ $+ [$nick] ] $+ .friendcode $3
  }
}

Comments

Sign in to comment.
deleteme1   -  Jul 12, 2013
KilllerX  -  Jul 12, 2013

I am seeing if I can use || (the pipes) to do an or with the checks if the information is correct. but I will give this a shot too. Also your !change part, makes me think that anyone can type the !change. the way I had it scripted I think it should check if it is that person, and only allow them to change. I am going to try and add a cooldown for this so that someone else can't interact with until the first person is done.

I will figure out that myself in a while.

deleteme1  -  Jul 12, 2013
Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.