Jump to content

Coding Error


Adolf

Recommended Posts

I've got this code I've just put togaether and a friend of mine who plays this game with me needs it to pull up some infomation for it with color tags for example:

[Player Name] 555:677 999:677

and since this is a war game those up there would be the cords to that player's (cities) so I made him a bot to allow him to pull up the players cords to their city but he wants it to have color like red for the cords he hasn't attacked yet and green for the ones he has and I've tried to use replace but I'm really rusty at this coding stuff I haven't coded since the msn days.

 

So;

 

if (%cc == !cords) && (%c == -a) { 
    .privmsg $chan Pulling up all the names in my data base...
    var %x = 1, %l = $ini($cf,Lords,0),
    while (%x <= %l) {
      var %n = $ini($cf,Lords,%x), %c = $readini($cf,Lords,%n), %h = $readini($cf,Hits,%n), %c = $replace(%c,%h,9 %h 4)
      .timer 1 $calc(%x + 2) /privmsg $chan %n $+ 's Cords are: %c
      inc %x
    }
    .timer 1 $calc(%x + 3) /privmsg $chan All the cords in my data base $nick <img src='http://www.tg007.net/forum/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />
  }

I dono where I went wrong only that its not working. $cf is the dir for the ini file. and I need it to replace the ones on the hit list to be color green while the other cords arent effected. So it would pull up in the list as:

 

Mark's cords are: 888:999 977:225 799:5667

 

The reason I use var for !cords and the sub-command is cuz the server I'm on has webchat and I have to strip away all the html coding.

Edited by Adolf
Link to comment
Share on other sites

why not just include the color code in the original %c and %h var

 

on LO:TEXT:*:#:{
  var %c = $strip($2), %cc = $strip($1) 
  if (!%c) && (%cc == !cords) { 
    .privmsg $chan 4Let me explain how to use this command real quick. 
    .privmsg $chan 4This is a multi-command. Meaning it has more then one use. To save space in my data base.
    .privmsg $chan 4Its very simple to use. So heres how to use it with examples:
    .privmsg $chan 4!cords -a/-u/+a/+h/-h/-ah the -a, -u, +a, +h, -h, are sub-commands to the command.
    .privmsg $chan 0Examples: !cords -a Will show all the cords of every user by for 4Example: Adolf 150:1600 in my data base.
    .privmsg $chan 0!cords -u [Player's Name] Will show only the cords for that player. 
    .privmsg $chan 0!cords +a [Player's Name] [Cords] Will add a user's cords to my data base. 4Example: Adolf 150:1600 This would now be logged in my data base for later use.
    .privmsg $chan 0!cords +h [Player's Name] [Cords] This will add the user to my known hits for that cord.
    .privmsg $chan 0!cords -h [Player's Name] This will show the cords hit on the player.
    .privmsg $chan 0Note any cords shown 9in0 have already been hit. Those shown 4in0 have not been hit.
  }
  if (%cc == !cords) && (%c == -a) { 
    .privmsg $chan Pulling up all the names in my data base...
    var %x = 1, %l = $ini($cf,Lords,0)
    while (%x <= %l) {
      var %n = $ini($cf,Lords,%x), %c = $readini($cf,Lords,%n)
      .timer 1 $calc(%x + 2) /privmsg $chan %n $+ 's Cords are: %c
      inc %x
    }
    .timer 1 $calc(%x + 3) /privmsg $chan All the cords in my data base $nick <img src='http://www.tg007.net/forum/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />
  }
  if (%cc == !cords) && (%c == -u) { 
    if ($3) { 
      var %h = $readini($cf,Hits,$3), %n = $readini($cf,Lords,$strip($3))
      if (%n) { .privmsg $chan $3 $+ 's cords are:4 %n }
      elseif (!%n) { .privmsg $chan $3 isnt on my data base sorry. }
    }
  }
  if (%cc == !cords) && (%c == +a) { 
    var %n = $3, %c = $readini($cf,Lords,%n), %c = %c $4- $+ $chr(32)
    if (%n) { .writeini $cf Lords %n %c | .privmsg $chan The cords for %n have been added to my data base. $4- has been added to %c }
  }
  if (%cc == !cords) && (%c == -h) {
    var %n = $3, %c = $readini($cf,Hits,%n)
    .privmsg $chan %n $+ 's cords that have been hit are: %c
  }
  if (%cc == !cords) && (%c == +h) {
    var %n = $3, %cord = $strip($4-), %cord = %cord $readini($cf,Lords,%n) $+ $chr(32)
    if (%n) && (%cord) { 
      .writeini $cf Hits %n $hits(%cord) 
      .privmsg $chan %n $+ 's cords have been added to hitlist.
    }
  }

}

is the full code I still cant seem to figure out how to add the color tags he wanted.

Edited by Adolf
Link to comment
Share on other sites

so you want the read for the hits to be a different color than the read from the lords?

 

yea like I cant figure out how to do it I've tried using $replace but for some reason I just cant code like I used to, and as its pulling up the cords

 

[Player]: !cords -u Holder

[bot]: Holder's cords are: 970:920 980:1012 981:1010 985:1014 982:1020 984:1020 983:1018 983:1026 984:1028 985:1034 986:1028 987:1026 976:1048

 

^ I'm trying to get it to do something like that but I cant seem to figure out how to make it do it. So after about 6 hours of trying to figure it out I came here to see if anyone could help me with it.

Link to comment
Share on other sites

mk is there any tuts on coding a hash table and I'll come back to you if I have any more problems then? I dont remember half the stuff I used to know. Hmm wait maybe I'll just look it up. I know that asking for something thats already here is a no no among coders. Thanks error.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...