mIRC Homepage

auto altering a script

Posted By: severnaya

auto altering a script - 19/01/05 07:16 PM

hi
I have a remote script that begins:
Code:
on 1:TEXT:*view*:*: { 


however, I want the text 'view' to be changed after X minutes, so that the command changes periodically..
is it possible to do this, or is it beyond the scope of mirc scripting?
hope u can help
thanx
Posted By: FiberOPtics

Re: auto altering a script - 19/01/05 07:18 PM

on *:TEXT:$(%myvar):*: do things

Then set %myvar to for example: *view*, *whatever*

Greets
Posted By: severnaya

Re: auto altering a script - 19/01/05 07:23 PM

thanx, so - if I declared %myvar, how would I make the value of %myvar change its value from a list every so often?
thanks again
Posted By: FiberOPtics

Re: auto altering a script - 19/01/05 07:36 PM

Well use a timer.

//timer 0 600 changevar

Will call an alias called "changevar" every 600 seconds, and keep running forever till you stop it manually or close mirc.

alias changevar {
; your if conditions to chose when you want to set what variable
if (blah) { set %myvar *views* }
elseif (bleh) { set %myvar *whatever* }
}

This is really a bit strange though, like, how do you expect your script to know what var it should set at what time? It's really more of a manual thing that you should set.

I can't help you further unless you specify under what conditions you want what as matchtext. Btw in mIRC /help /timer

You mentioned a list...what kind of list, where is this list, how should the script choose what from the list, what are the criteria? Should it be random? May it be the same value 2 times in a row, etc etc etc.

Be as specific as can be please.

Greets
Posted By: ricky_knuckles

Re: auto altering a script - 19/01/05 07:49 PM

nifty with the use of the variable as a parameter
smile
Posted By: ricky_knuckles

Re: auto altering a script - 19/01/05 07:53 PM

a list?
could he maybe make a txt and change
the on text using $read in some way
im still trying to wrap my mind around your example optics
$(%myvar)
?
still dont quite understand how it works
Posted By: FiberOPtics

Re: auto altering a script - 19/01/05 08:08 PM

Well, as you know you cannot put anything that needs evaluation directly into the matchtext. So you need to use $() to ensure evaluation.

So whatever you put between $() will first be evaluated rather than to match the actual variable text.

on *:TEXT:%myvar: will match on the actual word "%myvar" while if you $eval it like

on *:TEXT:$(%myvar): %myvar first evaluates to whatever value it holds, and then mIRC compares it to see if there is a match or not.

You can put identifiers in there as well:

on *:TEXT:$($+(*,$me,*)):#: echo -a Someone mentioned your nick

Greets
Posted By: ricky_knuckles

Re: auto altering a script - 19/01/05 08:10 PM

gotcha wink
thanks for the liquid clarity
what about using $read in the same fashion so he can have a random text trigger from a .txt
Posted By: FiberOPtics

Re: auto altering a script - 19/01/05 08:23 PM

Yeah you can put a read in there like:

on *:TEXT:$($read(myfile.txt,n)):

But that doesn't work as he wants it to. $read returns a random line, so it would be a different matchtext with every time the on text is triggered, while he wants to have a certain word to trigger for a while, and then switch to another word.

Greets
Posted By: ricky_knuckles

Re: auto altering a script - 19/01/05 11:02 PM

well i dont know but i know u can use play -t
to go through a section ina txt
but i dont know that you can implement it the way he would like
Posted By: severnaya

Re: auto altering a script - 19/01/05 11:06 PM

hi
by a list I meant either a txt file with different triggers per line, or some sort of arraylist of different trigger words. they should be selected at random, and it doesnt matter if the same ones are selected in a row..
thanks 4 your help, I will work on it
ps: I am a she not a he wink
Posted By: ricky_knuckles

Re: auto altering a script - 20/01/05 12:46 AM

excuse me ma'am it wont happen again
in any case this thread along with /help $read
should give you pretty much everything you need wink
Posted By: Mpdreamz

Re: auto altering a script - 20/01/05 09:31 AM

on *:TEXT:$($read(myfile.txt)):

as mentioned earlier should do that then
Posted By: Sigh

Re: auto altering a script - 20/01/05 10:05 AM

Actually a variable on its own in matchtext is evaluated, similar to including a variable in the target section of the header
Posted By: FiberOPtics

Re: auto altering a script - 20/01/05 12:15 PM

Indeed, if it's only a variable with nothing else, then it evaluates the variable, odd that I forgot that.

In the case of a mix of regular words and variables, the eval is needed like:

on *:TEXT:!kick %hehe:#: would trigger on !kick %hehe

whereas $(!kick %hehe):#: would trigger on !kick <value of %hehe>

Cya
Posted By: DaveC

Re: auto altering a script - 20/01/05 09:46 PM

I would suggest as you did that everyone use $(!kick %hehe):#: even if its is $(%hehe):#: better to keep regular coding practices than be jumping back and forth, cause u know one day your gonna change :%hehe:#: to :!kick %hehe:#: and then curse for half an hour tell you spot why it wont trigger
© 2020 mIRC Discussion Forums