mIRC Home    About    Download    Register    News    Help

Print Thread
simple Q - if $$input not filled echo a message #139344 13/01/06 12:05 PM
Joined: Oct 2005
Posts: 122
O
onesikgypo Offline OP
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
hi if im using something for example like

Code:
write -l $+ %x Popupacro.mrc $chr(46) $+ $$input(What Is The Input?,eo,Input Word) $+ $chr(58) $({,0) msg $($active,0) $$input(What Is The Output?,eo,Output Word) $(},0)


its currently set to not do anything if an input isnt given (the $$'s) but how can i allow it so for example if they hit cancel an echo comes up saying ** Could Not Proceed

Re: simple Q - if $$input not filled echo a messag #139345 13/01/06 12:35 PM
Joined: Nov 2005
Posts: 105
D
drc4 Offline
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
I'm not sure if I'm understanding correctly, because with using what you provided, an "Ok" button is all that I see. I don't see a "Cancel" button. But if a user was to click on "Ok" without entering text, you could "error check" that. It may not be the pretiest code, and a lot of others here are more gifted than I, but using
Code:
alias popupacro {
  unset %wordz*
  set %wordzin $input(What is the Input?,eo) {
  if (%wordzin == $null) { echo ** Could Not Proceed | goto end } }
  set %wordzout $input(What Is The Input?,eo) {
  if (%wordzout == $null) { echo ** Could Not Proceed | goto end } }
  else write -l $+ %x Popupacro.mrc $chr(46) $+ %wordzin $+ $chr(58) $({,0) msg $($active,0) %wordzout $(},0)
  :end
}

does the trick. Not sure how you call it yourself, but with this you'll have to call it using /popupacro . I'm sure you're capable of understanding it. The code's basically setting the text in the on input event to a variable, and checking it to see if it's blank ($null) or not. If this isn't what you're asking for, my apologies, I'm sure somewhere else can help.

Fixed code tags

Last edited by Mentality; 13/01/06 12:55 PM.
Re: simple Q - if $$input not filled echo a message #139346 13/01/06 12:45 PM
Joined: Oct 2005
Posts: 122
O
onesikgypo Offline OP
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
yup ive seen wut uve dont ty, dat should be fine, just wondering wut is the eltte rfor cancel, i know e is editbox and o is okay, but in /help $input it doesnt say wut cancel is, basically my "cancel" is if they hit the x in the top right hand corner instead of ok

Re: simple Q - if $$input not filled echo a message #139347 13/01/06 12:50 PM
Joined: Nov 2005
Posts: 105
D
drc4 Offline
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
Just change the
Quote:
$input(What Is The Input?,eo) - to - $input(What Is The Input?,ev)
It's in the help file... just isn't the most specific. The helpfile shows ( v - return $ok, $yes, $no, $cancel for buttons. ) I guess kind of confusing. Wasn't sure myself at first, but it works.

Last edited by drc4; 13/01/06 12:51 PM.
Re: simple Q - if $$input not filled echo a message #139348 13/01/06 01:34 PM
Joined: Oct 2005
Posts: 122
O
onesikgypo Offline OP
Vogon poet
OP Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
as well if someone could help us out, in a txt file i have
Code:
.c: { msg $active zzz }

then i have another script that echo's these in active, script is
Code:
alias acrolist {
  var %x $calc($lines(popupacro.mrc) - 1)
  var %y 26
  echo -a 4 Your Current Popup Acros Are:
  while (%y <= %x) {
    .Timer 1 2 echo -a 9 $read(Popupacro.mrc,%y)
    inc %y
  }
} 

What i wanted was atm it is just displaying the raw text which is fine, but i only wanted it to show to things, the input word and outputword

the input word is the word/letter after the . in the first letter so in this case, input word = c

the output word is the wordS after $active

so instead can i make it echo

Input: WORD Output: WORDS

Re: simple Q - if $$input not filled echo a message #139349 13/01/06 04:59 PM
Joined: Nov 2005
Posts: 105
D
drc4 Offline
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
To be honest with you, I'm not completly sure how I done it, but I think I succeeded in doing what you're asking for.
Code:
alias listacro {
  set %x 1
  set %y $lines(Popupacro.mrc)
  echo -a 9 Your Current Popups Are:
  while (%x <= %y) {
    set %linetest $read(Popupacro.mrc, %x)
    set %lineleft $replace(%linetest, msg $active, Output: $+ $chr(32))
    echo -a 9 $replace($remove(%lineleft,$chr(58)),$chr(46), Input: $+ $chr(32))
    inc %x
  }
}

The usage is /listacro. I'm sure it can be done much simplier, but that's the best I can come up with for now. I'm positive it can be done much, much easier, I just have no idea on how. I know that with the use of regex's it could be do much more efficiently, but this does the trick. Hope it works as expected.

Re: simple Q - if $$input not filled echo a messag #139350 13/01/06 05:20 PM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Assuming your format is constant within that file, here is a simplified version of what drc gave you:

Code:
alias acrolist {
  echo -a 09 Your Current Popups Are: 
  var %i = 1
  while (%i <= $lines(Popupacro.mrc)) {
    [color:green];  First we use $gettok to grab the first colon (:) delimited token which is .c
    ;  Since we don't want the . use $right to get only the character c
    ;  Next, we use $gettok again, but this time to grab the 5th (and everything after it) space delimited token(s)[/color]
    echo -a INPUT: $right($gettok($read(Popupacro.mrc, %i),1,58),1) - OUTPUT: $gettok($read(Popupacro.mrc, %i),5-,32)
    inc %i
  }
}


There was no reason to set a global var (%x) in this case because it only has use locally to this function.

For %y, it's really unecessary to set the $lines into it, because it's only being used once. Generally, this is only done when you want are referencing something numerous times in a script. And like %x it's not needed to set it as a global variable.

Also, when using colors you should always use double digits to be on the safe side. Say for example you want to display this text "1. This is line 1" in red color.

Using single digit color code:
Code:
41. This is line 1
Result: . This is line 1

Notice that it's not colored red like you thought it would be and it's also missing the 1 at the beginning. 
This is because it was interpreted as part of the color code (41) which does not exist and so the text isn't colored.


Using double digit color codes:
Code:
041. This is line 1
Result: [color:red]1. This is line 1[/color]