mIRC Home    About    Download    Register    News    Help

Print Thread
#126366 28/07/05 06:11 PM
Joined: Jul 2005
Posts: 3
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: Jul 2005
Posts: 3
i am in need of a calc script that dont calc normal but that
like number 1 = 0 and 2 = 83 and so it goes up (as an exp table) and it will only count up to 99, numbers over 99 will not count.. someone that can give a hand? smile

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
You should try to figure out yourself (on paper for example) what you want the script to do, because I'm quite sure no one will be able to understand what you're asking...

1 = 0
2 = 83
3 = ? 166 ? no that's above 99, so it's maybe 84?
Also, exponential tables and 0 don't really mix.

Maybe we can help somewhat if you can tell what the script is for, what it should do, or what it should return for various inputs.

Joined: Jul 2005
Posts: 3
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: Jul 2005
Posts: 3
yeah quite hard to explain =\
i type back in some time and have something better.

Its based on an Exp table


Level exp
1 0
2 83
3 174
4 276
5 388
6 512
7 650
8 801
9 969
10 1154

so when you type !exp 3 5
its going to calc how much exp there are between lvl 3 and 5 with is
388-174 = 214

(dont realy know how more to explain it =\ )

Last edited by zplinter; 28/07/05 06:41 PM.
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
If you have the way to calculate those levels, that would make it much easier. If not, make an ini file exp.ini with for each level the exp value, like

[experience]
1=0
2=83
3=174
...
99=1215514


Then put this in your remotes section

alias expdiff {
; usage: $expdiff(3,5)
; absolute value is returned, so $expdiff(5,3) returns the same value
if (($1 !isnum 1-99) || ($2 !isnum 1-99)) return
return $abs($calc($readini(exp.ini,experience,$2) - $readini(exp.ini,experience,$1)))
}

; for your bot to respond to other people:
on *:TEXT:!exp & &:#channelname: {
if ($expdiff($2, $3) != $null) msg $chan Difference is $v1 points
[/color:orange]else msg $chan incorrect levels![/color]
}

Make sure you change the channel name. You can leave out the orange part if you don't want to return anything when something wrong is asked.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Heh... there is a good example of why you should spell things out. Kelder and I both thought you were referring to exponents and not experience.

Probably the easiest thing to do (and which would allow you simple editing of the experience values later) is to make a text file that is in the format you used:

level experience
1 0
2 83
3 174
etc

NOTE: Include the header line in the text file (the "level experience" line)

Then, do this:
Code:
on *:text:!exp*:#: {
  .msg $chan There is $abs($calc($read(exp.txt,s,$2) - $read(exp.txt,s,$3))) experience between level $2 and level $3 $+ .
}


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2005
Posts: 3
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: Jul 2005
Posts: 3
tyvm Kelder it works realy good =D


Link Copied to Clipboard