Jump to content

the great script gurus help script noobs topic


CoZ

Recommended Posts

i made this topic so the script noobs can be helped a bit with coding

unfortunately im one of the script noobs :P

k i knew a bit about programming. but nothing about mirc , and after a while of looking at the mta and mtagus code i figered out how to do mta.text .. :P

k .. now i took the giant leap forward and thought .. lets try and create something myself

well .. basically , you wont be surprised if its not working right ?

on *:SIGNAL:mta.text:{
 if (badword isin $3) || (badword isin $3) || (badword isin $3) || (badword isin $3) {
   if (%warned == $mta.nick($1,%a) ) {
     mta.text $1 A warning was set. You are muted for 10 seconds !
     mta.mute $1 $mta.nick($1,%a)
     !.timer 1 10 mta.unmute $1 $mta.nick($1,%a)
     unset %warned 
   }
   else {
     mta.text $1 Dont use bad language ! A warning is set. 
     set %warned $mta.nick($1,%a)
   }
 }
}

maybe im going about this is a completely wrong way ..

but well .. tell me :D

Link to comment

Replace all the %a's with $2's, mta.mute uses serverID and playerID, not name.

Apart from that it's not bad, except only 1 person can be warned, and it only checks the 1st word.

Array:

on *:SIGNAL:mta.text:{
 if (badword isin $3-) || (badword isin $3-) || (badword isin $3-) || (badword isin $3-) {
   if (%warned [ $+([ $1 ],.,[ $2 ]) ] == 1) {
     mta.text $1 A warning was set. You are muted for 10 seconds !
     mta.mute $1 $2
     !.timer 1 10 mta.unmute $1 $2
     !.timer 1 10 set %warned [ $+([ $1 ],.,[ $2 ]) ] 0
   }
   else {
     mta.text $1 Dont use bad language ! A warning is set.
     set %warned [ $+([ $1 ],.,[ $2 ]) ] 1
   }
 }
} 

Link to comment

k ..thnx

it didnt enter the if warning was set but i found that

if (%warned == [ $+([ $1 ],.,[ $2 ]) ] 1) {

made it

old

seems to work :D

yey , thanks a lot

edit no it didnt but with this edit it does

Edited by Guest
Link to comment

Actually that's pretty much the same as the one you had before, just setting the one variable to a more useless value.

You can make it look like an array however you want, but mirc allows the use of [ ] brackets, for people who're used to them.

%wanted [ $+ [ ] ]

%wanted [ $+ [ ] $+ . $+ [ ] ]

...was wrong before, not used mirc much for a long time :wink:

Link to comment

uuh .. maybe

im not used to mirc scripting at all

(i wasnt joking when i said i think i can handle mta.text :P )

.. let alone arrays in mirc (well ok i admit , never been to smart with arrays in any language :D )

i just thought %warned [ $+([ $1 ],.,[ $2 ]) ] == 1 wouldnt pass the if .. since the value in memory was

warned 1.0 1

(i discovered the variable button in script editor :D )

maybe im stil using a slightly odd way but at least its working solid on one word :D

k the warn mute and unwarn work .. and i could settle for copying the entire function and change badword .. but that doesnt seem to work too well

maybe its possible with some sort of array of words

maybe you can shed some light on that :D

i even induced the timer to unset warning after a minute :D

on *:SIGNAL:mta.text:{
 if (badword isin $3-) {
   if (%warned == [ $+([ $1 ],.,[ $2 ]) ] 1) {
     mta.text $1 A warning was set. You are muted for 10 seconds !
     mta.mute $1 $2 
     !.timer 1 10 mta.unmute $1 $2
   !.timer 1 10 set %warned [ $+([ $1 ],.,[ $2 ]) ] 0   }
   else {
     mta.text $1 Dont use bad language ! A general no swearing warning is set for 1 minute !
   set %warned [ $+([ $1 ],.,[ $2 ]) ] 1 
   !.timer 1 5 set %warned [ $+([ $1 ],.,[ $2 ]) ] 0   }
   elseif (please isin $3) {
     mta.text $1 Dont beg 
   set %warned [ $+([ $1 ],.,[ $2 ]) ] 0 }
 }
 elseif (please isin $3) {
   mta.text $1 Dont beg 
   set %warned [ $+([ $1 ],.,[ $2 ]) ] 0 
 }
}

Link to comment
  • 3 weeks later...

ive settled on this

 elseif ( word || word || word || word || word || word || word isin $3-) {
   if (%warned == [ $+([ $1 ],.,[ $2 ]) ] 1) {
     mta.pm $1 $2 A warning was set. You are muted for 10 seconds !
     mta.mute $1 $2 
     !.timer 1 10 mta.unmute $1 $2
   !.timer 1 10 set %warned [ $+([ $1 ],.,[ $2 ]) ] 0   }
   else {
     mta.pm $1 $2 Dont use bad language ! A general no swearing warning is set for 1 minute !
     set %warned [ $+([ $1 ],.,[ $2 ]) ] 1 
   !.timer 1 5 set %warned [ $+([ $1 ],.,[ $2 ]) ] 0   }
   elseif (please isin $3-) {
     mta.text $1 Dont beg 
   set %warned [ $+([ $1 ],.,[ $2 ]) ] 0 }
 }
 elseif (please isin $3-) {
   mta.text $1 Automessage: Dont beg 
   set %warned [ $+([ $1 ],.,[ $2 ]) ] 0 
 }

doubt its perfect , but it works :)

meanwhile i tried a few other things too

all sorts of automessages

pretty useless but fun

i had basic automessages but they got boring after a few times so i induced a bit of randomness in it :)

on *:SIGNAL:mta.text:{
 if (look isin $3-) {
   set %rand $rand(0,3)
   if (%rand == 0 ) mta.text $1 Are you looking at me ?
   elseif (%rand == 1 ) mta.text $1 Automessage: Yes, you look pretty
   elseif (%rand == 2 ) mta.text $1 Automessage: Be sure to look at http://nlcozmtaserver.blogspot.com 
   elseif (%rand == 3 ) mta.text $1 Automessage: Yes it's nice to look at http://nlcozmtaserver.blogspot.com 
   else mta.text $1 Automessage: Yes, look here : http://nlcozmtaserver.blogspot.com 
 }

[uVA]_ZzZ , i wonder how the gold , silver thing is made running on the uva server

Link to comment

Just uses start, end and finish race events to figure out where they came :wink:

You could stick those message lines into a text file then read the line number of

$rand(1,$lines(txt.txt))

Oh, and the array thing you're using is still wrong, you're storing:

key: warned - value: 1.0 1

instead of:

key: warned1.0 - value: 1

You need to use it like i said:

%warned [ $+ [  ] $+ . $+ [  ] ] 

Link to comment
  • 2 weeks later...

is there a write command that doenst replace the line

i tried to make something like

  elseif ($3 == !addtolist)       {
  if ($mta.race($1) == Unknown)          { 
   if ($4- == $null)       {
    mta.pm $1 $2 Sorry map unknown - type !addtolist mapname 
    }
  elseif  ($4- != $null) !writeini -n " $+ $scriptdir $+ favorite.ini" MAP $mta.nick($1,$2) $4-
   }   
 else !writeini -n " $+ $scriptdir $+ favorite.ini" MAP $mta.nick($1,$2) $mta.race($1)
 }
 }

(k this is a old and probably non working version as i accidentally deleted the latest, but you get the idea

a list where people can add their favorite maps )

i figured it might have been the -n after !writeini .. but uhm .. nope

Link to comment
  • 3 months later...
is there a write command that doenst replace the line

i tried to make something like

  elseif ($3 == !addtolist)       {
  if ($mta.race($1) == Unknown)          { 
   if ($4- == $null)       {
    mta.pm $1 $2 Sorry map unknown - type !addtolist mapname 
    }
  elseif  ($4- != $null) !writeini -n " $+ $scriptdir $+ favorite.ini" MAP $mta.nick($1,$2) $4-
   }   
 else !writeini -n " $+ $scriptdir $+ favorite.ini" MAP $mta.nick($1,$2) $mta.race($1)
 }

(k this is a old and probably non working version as i accidentally deleted the latest, but you get the idea

a list where people can add their favorite maps )

i figured it might have been the -n after !writeini .. but uhm .. nope

hehe .. yay

figured it out with a other command

well at least created a working workaround.... not use two of the same names :D - but date+time+nick

 elseif ($3 == !feedback) {
   if ($4 != $null) {
     %test = $replace($fulldate $+ $mta.nick($1,$2),$chr(32),)
     !writeini -n " $+ $scriptdir $+ feedback.ini" FEEDBACK $replace(%test, $chr(58),) $4-
     mta.pm $1 $2 small chance i wont read it this way .. you can also post feedback to http://nlcozmtaserver.blogspot.com  
   }
   else mta.pm $1 $2 Error - Cannot feedback nothing
 }

Link to comment

oh yeah, didnt notice something, you did fine, cause you cant have the first arg in the ini with spaces, but i'd do that like:

var %test = $+($replace($fulldate,$chr(32),$chr(95)),$chr(58),$mta.nick($1,$2))
!writeini " $+ $scriptdir $+ feedback.ini" FEEDBACK %test $4-

but there is not much difference with your one :P

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...