mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#240637 19/02/13 10:27 AM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
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.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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. }
}

hixxy #240651 19/02/13 09:07 PM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
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

Last edited by LinktersHaZe; 19/02/13 11:11 PM.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

hixxy #240658 20/02/13 07:17 AM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
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

Last edited by LinktersHaZe; 20/02/13 08:43 AM.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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. }
}

hixxy #240678 21/02/13 01:08 PM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
can you add me on skype:
LinktersHD

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

hixxy #240683 21/02/13 06:19 PM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
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

Last edited by LinktersHaZe; 21/02/13 06:28 PM.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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

Last edited by hixxy; 21/02/13 10:36 PM. Reason: Fixed.
hixxy #240687 21/02/13 09:44 PM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
So what would i do for champion.ini now, since it has been changed.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

hixxy #240706 22/02/13 04:33 PM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
Thanks!

HOw do i add seperators "|" like "AD: 101 | Health 1740 etc)"

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Use $chr(124)


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
$chr(124) = | , and if you looking for other $chr() in the future you can use: //echo -a $asc(|) or what sign you lookign for.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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. }
}

hixxy #240717 23/02/13 09:04 AM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
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.

Last edited by LinktersHaZe; 23/02/13 09:06 AM.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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
  }
}

hixxy #240731 23/02/13 05:02 PM
Joined: Feb 2013
Posts: 12
L
Pikka bird
OP Offline
Pikka bird
L
Joined: Feb 2013
Posts: 12
Instead of it changing it to 19 after the level goes over 19 can you do it so it throughs a message. Thanks.

Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
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.

Page 1 of 2 1 2

Link Copied to Clipboard