mIRC Homepage
Posted By: LinktersHaZe Commands Help - 19/02/13 10:27 AM
I'm making a League of Legends script:
on *:TEXT:!stats Master Yi:#: { msg $chan Master Yi @ level 1: 355 MS, 125 range, 444 HP (+86/lvl), 199 MP (+36/lvl), 6.75 HP5 (+0.65/lvl), 6.5 MP5 (+0.45/lvl), 16.3 armor (+3.7/lvl), 30 MR (+1.25/lvl), 55.1 damage (+3.1/lvl), 0.679 AS (+2.98%/lvl) }

I was wondering i could make each champion be a in a .txt file and make the script read from there.

Also if you could do a !stats Yi 2 so all numbers are * by 2 and etc.

I need help ASAP please.
Posted By: hixxy Re: Commands Help - 19/02/13 08:01 PM
Your question seems to assume we know what league of legends is. Maybe somebody does, but you're more likely to get help if you could explain specifically what you want to do.

What does "make each champion be a in a .txt file and make the script read from there." mean?

If it means what I think it means, then you could create a file called champions.txt in your mIRC directory and copy/paste all of the lines of text exactly like the one you've just posted into it, then load this script into remotes (Alt+R):

Code:
on *:text:!stats *:#:{
  if ($read(champions.txt,nw,$2- *) != $null) { msg $chan $v1 }
  else { msg $chan Champion $qt($2-) not found. }
}
Posted By: LinktersHaZe Re: Commands Help - 19/02/13 09:07 PM
So i do lets pretend Ashe so !Stats ashe i would past in the ashe.txt:
Ashe @ level 1: 325 MS, 600 Range, 395 HP (+97/lvl), 4.50 HPS (+0.55/lvl), 11.5 armour (+3.4/lvl), 6.3 MR (+0.4/lvl), 46.3 damage (+2.85/lvl), 0.658 AS (+3.34%/lvl)

Or would it be:
Code:
on *:TEXT:!stats Anivia:#: { msg $chan Anivia @ level 1: 325 MS, 600 range, 350 HP (+70/lvl), 4.65 HP5 (+0.55/lvl), 10.5 armor (+4/lvl), 30 MR (+0/lvl), 48 damage (+3.2/lvl), 0.625 AS (+1.68%/lvl) }

Also which mirc directory, Local file? and how do i edit it so it picks a certain directory. not Mirc
Posted By: hixxy Re: Commands Help - 19/02/13 11:29 PM
Code:
on *:text:!stats *:#:{ 
  if ($isfile($2-.txt)) { msg # $read($2-.txt,nt,1) }
  else { msg # $qt($2-) invalid champion. }
}


If there is going to be a different level on each line in the file, and you want to be able to specify the level number but have it default to one, then this should do that:

Code:
on *:text:!stats *:#:{ 
  var %level = 1, %champion = $2-
  if ($eval($ $+ $0,2) isnum) { 
    %level = $v1 
    %champion = $deltok($2-,-1,32)
  }
  if ($isfile(%champion $+ .txt)) { msg # $read(%champion $+ .txt,nt,%level) }
  else { msg # $qt(%champion) invalid champion. }
}


You can see where the mIRC directory is by typing "/run ." in mIRC.
Posted By: LinktersHaZe Re: Commands Help - 20/02/13 07:17 AM
It worked, But i dont want to enter each level manually. Is there any code which multiplies numbers or etc.

This is a idea which might be neater (though try the top text first):
Code:
this is what you have in file now
annie 335 MS, 625 range, 384 HP (+76/lvl), 250 MP (+50/lvl), 4.5 HP5 (+0.55/lvl), 6.9 MP5 (+0.60/lvl), 12.50 armor (+4.00/lvl), 30.00 MR (+0.00/lvl), 49.00 damage (+2.63/lvl), 0.579 AS (+1.360%/lvl)
 
what i was thinking when suggested files was to do
annie.txt
MS:335
range:625
HP:384
HPlvl:76
...
 
and do a function in the bot script that reads the values, and puts it together into the message one by one.
that way, whan you do at lvl 3. in the code that pieces it together there will just be [HP]+(lvl*[HPlvl] and it will do all the math by itself, no need to write anymore in the data than the basic info
Posted By: hixxy Re: Commands Help - 20/02/13 07:59 PM
Using a different file for each one seems terribly inefficient. Have you thought about using a single .ini file? They are perfect for this. The format of an ini file is:

[topic]
item=data
item2=data2

So you could have one file, say, champions.ini, and in it you would put this:

[annie]
MS=335
range=625
HP=384
HPlvl=76

[Master_Yi]
range=125
HP=444
MP=199
HP5=6.75
MP5=6.5
Armor=16.3
MR=30
Damage=55.1
AS=0.679

The "_" in "Master_Yi" could be replaced back to a space afterwards.

This would make it much easier to work with.

Then the script:

Code:
on *:text:!stats *:#:{ 
  var %level = 1, %champion = $replace($2-,$chr(32),_), %output
  if ($eval($ $+ $0,2) isnum) { 
    %level = $v1 
    %champion = $replace($deltok($2-,-1,32),$chr(32),_)
  }
  if ($ini(champion.ini,%champion)) { 
    var %i = 1
    while ($ini(champion.ini,%champion,%i) != $null) {
      %output = %output $v1 $+ : $calc($readini(champion.ini,n,%champion,$v1) * %level)
      inc %i
    }
    msg # $+($chr(2),Stats for $replace(%champion,_,$chr(32)),$chr(2)) %output
  }
  else { msg # $qt($replace(%champion,_,$chr(32))) invalid champion. }
}
Posted By: LinktersHaZe Re: Commands Help - 21/02/13 01:08 PM
can you add me on skype:
LinktersHD
Posted By: hixxy Re: Commands Help - 21/02/13 06:05 PM
Originally Posted By: LinktersHaZe
can you add me on skype:
LinktersHD


Sorry, I don't have Skype, but I'm more than happy to continue to help you here.
Posted By: LinktersHaZe Re: Commands Help - 21/02/13 06:19 PM
Originally Posted By: hixxy
Originally Posted By: LinktersHaZe
can you add me on skype:
LinktersHD


Sorry, I don't have Skype, but I'm more than happy to continue to help you here.


Ok, how come when i do !stats annie 2 it's higher than it's suppose to be. Each "Text" has:
350 HP (+70/lvl) which is suppose to be added to the previous value. So all numbers in brackets not "/1v1)" are times.

EDIT:
I MEANT ADD NOT TIMES. SORRY
Posted By: hixxy Re: Commands Help - 21/02/13 09:22 PM
Code:
on *:text:!stats *:#:{ 
  var %level = 1, %champion = $replace($2-,$chr(32),_), %output
  if ($eval($ $+ $0,2) isnum) { 
    %level = $v1
    %champion = $replace($deltok($2-,-1,32),$chr(32),_)
  }
  if ($ini(champion.ini,%champion)) { 
    var %i = 1
    while ($ini(champion.ini,%champion,%i) != $null) {
      if (*lvl !iswm $v1) { %output = %output $v2 $+ : $calc($readini(champion.ini,n,%champion,$v2) + ($readini(champion.ini,n,%champion,$v2 $+ lvl) * (%level - 1))) }
      inc %i
    }
    msg # $+($chr(2),Stats for $replace(%champion,_,$chr(32)),$chr(2)) %output
  }
  else { msg # $qt($replace(%champion,_,$chr(32))) invalid champion. }
}


Try this smile
Posted By: LinktersHaZe Re: Commands Help - 21/02/13 09:44 PM
So what would i do for champion.ini now, since it has been changed.
Posted By: hixxy Re: Commands Help - 21/02/13 10:35 PM
Same as what I said before, but you need to append "lvl" after each stat to specify how much it will go up per level:

Quote:

[annie]
MS=335
MSlvl=10
range=625
rangelvl=400
HP=384
HPlvl=30
HPlvl=76

[Master_Yi]
range=125
HP=444
MP=199
HP5=6.75
MP5=6.5
Armor=16.3
MR=30
Damage=55.1
AS=0.679


etc...

Please note I edited the script in my last post since you replied.
Posted By: LinktersHaZe Re: Commands Help - 22/02/13 04:33 PM
Thanks!

HOw do i add seperators "|" like "AD: 101 | Health 1740 etc)"
Posted By: Riamus2 Re: Commands Help - 22/02/13 04:57 PM
Use $chr(124)
Posted By: sparta Re: Commands Help - 22/02/13 05:31 PM
$chr(124) = | , and if you looking for other $chr() in the future you can use: //echo -a $asc(|) or what sign you lookign for.
Posted By: hixxy Re: Commands Help - 22/02/13 05:52 PM
Just to incorporate what Riamus and sparta said into the script:

Code:
on *:text:!stats *:#:{ 
  var %level = 1, %champion = $replace($2-,$chr(32),_), %output
  if ($eval($ $+ $0,2) isnum) { 
    %level = $v1
    %champion = $replace($deltok($2-,-1,32),$chr(32),_)
  }
  if ($ini(champion.ini,%champion)) { 
    var %i = 1
    while ($ini(champion.ini,%champion,%i) != $null) {
      if (*lvl !iswm $v1) { %output = %output $chr(124) $v2 $+ : $calc($readini(champion.ini,n,%champion,$v2) + ($readini(champion.ini,n,%champion,$v2 $+ lvl) * (%level - 1))) }
      inc %i
    }
    msg # $+($chr(2),Stats for $replace(%champion,_,$chr(32)),$chr(2)) $gettok(%output,1-,124)
  }
  else { msg # $qt($replace(%champion,_,$chr(32))) invalid champion. }
}
Posted By: LinktersHaZe Re: Commands Help - 23/02/13 09:04 AM
Thanks Hixxy :D, You're the best. If you want to try out the bot go to quakenet and join #lolstats.

Edit: One final question, How can i do it so they can only do up to 18 and not do like "!stats yi 10000". Also how do i do it so they bot ingnores a user for 5 seconds after he has done one of the commands.
Posted By: hixxy Re: Commands Help - 23/02/13 11:08 AM
No probs smile

Code:
on *:text:!stats *:#:{ 
  if (!$hget(stats_ignore,$nick)) {
    hinc -mu5 stats_ignore $nick
    var %level = 1, %champion = $replace($2-,$chr(32),_), %output
    if ($eval($ $+ $0,2) isnum) { 
      %level = $v1
      %champion = $replace($deltok($2-,-1,32),$chr(32),_)
    }
    if (%level > 19) { %level = 19 }
    if ($ini(champion.ini,%champion)) { 
      var %i = 1
      while ($ini(champion.ini,%champion,%i) != $null) {
        if (*lvl !iswm $v1) { %output = %output $chr(124) $v2 $+ : $calc($readini(champion.ini,n,%champion,$v2) + ($readini(champion.ini,n,%champion,$v2 $+ lvl) * (%level - 1))) }
        inc %i
      }
      msg # $+($chr(2),Stats for $replace(%champion,_,$chr(32)),$chr(2)) $gettok(%output,1-,124)
    }
    else { msg # $qt($replace(%champion,_,$chr(32))) invalid champion. }
  }
}


I've made this one so that if the level specified is more than 19, it just changes it to 19. Let me know if you would rather it throw out an error message.

I've added a per-user ignore feature, so each user can only use it once every five seconds. If you would rather it only be used once every five seconds no matter who uses it, then change these two lines:

Code:
  if (!$hget(stats_ignore,$nick)) {
    hinc -mu5 stats_ignore $nick


To:

Code:
  if (!%stats_ignore) {
    inc -u5 %stats_ignore


If you want to keep the per-user ignore feature and want it to keep track of people who change their nicknames to get around the ignore, add this:

Code:
on *:nick:{
  if ($hget(stats_ignore,$nick).unset) {
    hinc -u $+ $v1 stats_ignore $newnick
    hdel stats_ignore $nick
  }
}
Posted By: LinktersHaZe Re: Commands Help - 23/02/13 05:02 PM
Instead of it changing it to 19 after the level goes over 19 can you do it so it throughs a message. Thanks.
Posted By: Deega Re: Commands Help - 24/02/13 03:19 AM
Just change this line
Code:
    if (%level > 19) { %level = 19 }

To this
Code:
    if (%level > 19) {
      msg # Add your message here.
      return
    }
and change the message to whatever you want.
Posted By: LinktersHaZe Re: Commands Help - 24/02/13 05:22 PM
How do i do it so when i do !stats annie 2 so instead of it saying "Stats for annie" it says "Stats for annie @ levl X"?

Thanks.
Posted By: hixxy Re: Commands Help - 24/02/13 11:23 PM
Change this:

Code:
msg # $+($chr(2),Stats for $replace(%champion,_,$chr(32)),$chr(2)) $gettok(%output,1-,124)


To this:

Code:
msg # $+($chr(2),Stats for $replace(%champion,_,$chr(32)) @ level %level,$chr(2)) $gettok(%output,1-,124)
© mIRC Discussion Forums