Jump to content


  • Posts

  • Joined

  • Last visited


  • Gang

damnet007's Achievements


Transformer (11/54)



  1. lol i'm still not 100% sure what you want, but how about this: if ($chr(33) isin $4) !return $remove($4,$chr(33)) but that won't work well if the ! isnt at the start- if someone typed ... !blah!kjd
  2. If you're trying to do what I think, use "isin" if (... isin $4) or if (... isin $4-)
  3. i sorted this a while ago by using a different while loop and a snippet from toady's mta.longsay alias, works perfectly now and squall if you don't understand it or don't have anything useful to say, keep out; i posted for help and that's what i got.
  4. damnet007

    !rank script

    I have a massive script and I use these $iif statements quite a bit, they don't slow anything down. I read your previous post and changed the alias names
  5. damnet007

    !rank script

    i can say that it works, it works fast on my pc, and as long as it works i dont care about any criticism made, i like my $iif statements as they don't make a lot of difference when processing and the script still works perfectly, the only thing someone might find a headache is when scripting the statement as there are so many brackets, but that's also not hard.
  6. damnet007

    !rank script

    Here's something I tried, I don't really script for mta:sa so don't know if I've converted it right, try it if you want on *:SIGNAL:mta.join:{ !writeini -n " $+ $scriptdir $+ ranks.ini" ranks $mta.nick($1,$2) $calc($joinamt($1,$2) + 1) } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$iif($mta.getid($1,$4),$v1,-1)),$2) if ($3 == !rank) { if (%a == -1) mta.pm $1 $2 Error - Absent Nick/ID else mta.text $1 $mta.nick($1,%a) > Rank: $playerrank($1,%a) ( $+ $joinamt($1,%a) $+ pts) } } alias playerrank !return $iif($joinamt($1,$2) <= 4,Newbie,$iif($joinamt($1,$2) <= 9,Wannabe Amateur,$iif($joinamt($1,$2) <= 14,Amateur,$iif($joinamt($1,$2) <= 19,Wannabe Professional,$iif($joinamt($1,$2) <= 24,Professional,$iif($joinamt($1,$2) <= 29,Smooth Agent,$iif($joinamt($1,$2) <= 34,Dangerous Killer,$iif($joinamt($1,$2) > 34,Murderer)))))))),Unranked) alias joinamt !return $iif($readini(ranks.ini,ranks,$mta.nick($1,$2)),$v1,0)
  7. !writeini -n " $+ $scriptdir $+ bla.ini" bla bla $calc($readini(bla.ini,bla,bla) + 1)
  8. Sorry, didn't see your post until now. Basically, you can hold an unlimited amount of items. These items are made by other users who own factories, etc. When a factory owner produces an item, they specify which category the item goes into. These item categories are stored in things.ini and everything has already been scripted. The reason I posted here was because I needed a script to find all items owned by a person, which are in the 'food' category- all my scripting attempts worked fine on my pc but kept causing mtama to time out on the scripts host pc when someone typed !food - i think the script took up a lot of cpu usage when run, and that's why I posted here, to try and find a better way to do it.
  9. thanks for the script toady, but I had an error in the line assigning %c and the last mta.say line. I've done this and it seems to work although it won't show any food items which don't fit into the first mta.say line (if this makes sense): alias showfood { var %a = 0,%b,%c if (!$ini(rpg.ini,$mta.name($1,$2),1)) mta.say $1 $mta.name($1,$2) has no food. else { while (%a <= $ini(rpg.ini,$mta.name($1,$2),0)) { %b = $ini(rpg.ini,$mta.name($1,$2),%a) if ($readini(rpg.ini,$mta.name($1,$2),%b) > 0) { if ($readini(things.ini,food,%b) == 1) { %c = $iif(%c,%c $+ $chr(44) $+(%b,$chr(40),$readini(rpg.ini,$mta.name($1,$2),%b),$chr(41)),$+(%b,$chr(40),$readini(rpg.ini,$mta.name($1,$2),%b),$chr(41))) } } !inc %a } mta.longsay $1 $mta.name($1,$2) $+ 's food: $iif(%c,$v1,None) } } alias mta.longsay { var %a = 1,%b while (%a <= $numtok($3-,32)) { if ($calc($len(%b) + $len($gettok($3-,%a,32))) <= 115) %b = $iif(%b,%b $gettok($3-,%a,32),$gettok($3-,%a,32)) else { mta.say $1 %b %b = $null } !inc %a } if (%b) mta.say $1 %b }
  10. I'm trying to optimize this script/find another, more efficient way of doing this: - A person's item data is stored in an ini file, eg rpg.ini : [name] item1=amount item2=amount ... - All the items are classified into different categories, in another ini, eg. things.ini: [food] item=1 item2=1 item3=1 ... [drinks] item1=1 item2=1 ... The script checks all of the user's items and if an item from rpg.ini is in the food section of things.ini, it adds them to the list of food items they have. I made this a little while ago and it seems to work perfectly on my PC, but not on the PC where I run scripts. Any ideas how this could be done? My script's below: alias showfood { var %b = 0,%d = 0,%c,%e,%f,%g,%h while (%b <= $ini(rpg.ini,$mta.name($1,$2),0)) { if ($readini(rpg.ini,$mta.name($1,$2),$ini(rpg.ini,$mta.name($1,$2),%b)) > 0) && ($readini(things.ini,food,$ini(rpg.ini,$mta.name($1,$2),%b)) == 1) { if (!%c) %c = $ini(rpg.ini,$mta.name($1,$2),%b) $+ ( $+ $readini(rpg.ini,$mta.name($1,$2),$ini(rpg.ini,$mta.name($1,$2),%b)) $+ ) elseif (%c) { %c = %c $+ $chr(46) $ini(rpg.ini,$mta.name($1,$2),%b) $+ ( $+ $readini(rpg.ini,$mta.name($1,$2),$ini(rpg.ini,$mta.name($1,$2),%b)) $+ ) %d = %d + 1 if %d > 5 { %h = $gettok(%c,24-29,46) %g = $gettok(%c,18-23,46) %f = $gettok(%c,12-17,46) %e = $gettok(%c,6-11,46) %c = $gettok(%c,1-5,46) } } } !inc %b } mta.msg $1 $2 $mta.name($1,$2) $+ : $iif(%c,%c,No Food) if (%e) mta.msg $1 $2 Food: %e if (%f) mta.msg $1 $2 Food: %f if (%g) mta.msg $1 $2 Food: %g if (%h) mta.msg $1 $2 Food: %h } The reason I have %e - %h is because there are loads of different food items a person can have, and mta has that text limit thanx
  11. %a is a variable, $4 is a parameter. you have to assign value(s) to a variable in most cases, and most common variables are only present within specific functions/aliases, eg: if you have a script to count from 'x' to 0, you could use a variable (name it whatever you want), and do it like this: on *:SIGNAL:mta.command:{ if ($3 == !count) { if ($4) && ($4 isnum) && ($4 > 1) { <-- $4 is the 2nd word a person would say in a sentence. If i typed '!count 200' then $4 would be '200' var %x = $4 <-- Assign variable x - it has been made equal to $4 as this is the value we are counting down from. while %x > 0 { mta.say $1 Countdown: %x !dec %x } } else mta.msg $1 $2 Error - Syntax: !count } } This should show you that variables and parameters are different %a could return any value you set it to return, $4 is usually an assigned constant. That's how i look at it anyway, i didn't learn from any tuts etc so i make up my own ways of understanding (lol)
  12. remove the 'if (%a != -1)' line and the bracket which goes with it. if u want, add me on msn i'll help you out
  13. something like this: on *:SIGNAL:mta.command:{ if $readini(bla.ini,admin,$mta.name($1,$2)) == 1 { var %a = $iif($4 == $null,$2,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4))) if (%a != -1) { if ($3 == !slap) mta.slap $1 %a elseif ($3 == !kick) mta.kick $1 %a etc... } else mta.msg $1 $2 Error - Absent Nick/ID } } bla.ini: [admin] name=1 name2=1 etc.
  • Create New...