mIRC Homepage
Posted By: Lackey Inputs - 12/12/02 02:04 AM
I am creating a script that calls for multiple inputs, then inserts those inputs into a command. How do I asign each input to a value, then use those values later when it runs the command? Thank you.
Posted By: Frog Re: Inputs - 12/12/02 02:30 AM
Have it set variables accordingly. eg: on *:input:*:if ($1 == bah) set %Bah value

..or something like that. Anyway
Posted By: Cobra Re: Inputs - 12/12/02 03:27 AM
there are many ways to do it

depending on what all your wanting this to do, i'd probly recomend hash tables, or if u dont know hash perhaps ini files.

although ini files are for more perminat values realy ..

if i read your question right u dont mean input as in like an on input event, but rather a script that asks for input from the end user, useing perhaps $$?="" or $input() or a custom dialog?

if so just set these values up in a hash table, in there own varables, or in an ini file

and you will be able to refrence the values again later

or if your just doing somethign extreamly simple..

Code:
my.input {
  set %input.nick $$?="Enter your nick"
  set %input.age $$?="Enter your age"
  set %input.color $$?="Enter your fav color"
}


its hard for me to answer your question specificly without knowing more information about what your trying.

hope this was helpful, if not please re explain wiht more detail smile

Cobra^
Posted By: Lackey Re: Inputs - 12/12/02 08:24 AM
Thanks for your help, I have it all working just fine now. Just one last thing, how would I make it so they can input something, and have it save directly into their perform.ini?
I am writing a basic script to help my clan get setup with auto-joining our channels and registering and authing. The last thing I can think of is to create a pop-up where they can input their info, and have it save directly into the auth command and put it in perform.ini. Any thoughts on how to do that?
Posted By: Aubs Re: Inputs - 12/12/02 01:08 PM
Something like this you mean?:
Code:
/personal.input {
  unset %personal.input
  var %personal.input $$?="please enter your personal info"
  if (%personal.input !== $null) { /writeini -n preform.ini personal input %personal.input }
  unset %personal.input
}

The -n makes mIRC attempt to write to the ini file even if it is greater than 64k in size
(look at: /help /writeini)

Hope this helps?!
Posted By: Lackey Re: Inputs - 12/12/02 04:58 PM
OK, couple questions on that:
1. Is it necessary to unset it before, since it will just be overwritten anyway?

2. Whats the part with (%personal.input !==%null) mean?

Also, what would delete specific items from perform.ini? So I could have them input the channels they want to join on connect, and then it adds them, but if they want to change them later, they can easily remove them from the list and add a new on.
Posted By: Aubs Re: Inputs - 12/12/02 05:23 PM
answer to the two points:

Yes (Well, as a precaution) it is necessary to unset first, this is because if, for some reason it has not been unser previously, from another script maybe, then if the user doesn't enter any data, the variable will not be altered.

say:
set %i This is some crap
set %i $$?="enter something"
if I press cancel, the variable %i will still remain as "This is some crap"

Secondly:

I know other people prefer to use (!%variable), but I prefer to write it out in the full...Easilly understandable:

if (%variable !== $null)
means:
(%variable(1) !(2)==(3) $null(4) )
if (%variable(1) NOT(2) equals(3) Nothing(4)

So, if the variable is not empty, do what ever follows in the { }

I don't think I've explained it properly, sorry, am in a rush to leave work!!!

Take a look at: /help if then else
Posted By: Lackey Re: Inputs - 14/12/02 03:55 AM
Ok, so I wrote a small script to help people new to mIRC in clans to setup themselves. I see that you can add stuff to the perform.ini...but still not sure how to do it. Here's the alias for my script...where I need to figure out how to have the channels inputed join on connect:
Code:
alias /addchannel {
  if [ %channel1 == $null ] { set %channel1  #$$?="Enter Channel" | goto end }
  if [ %channel2 == $null ] { set %channel2  #$$?="Enter Channel" | goto end }
  if [ %channel3 == $null ] { set %channel3  #$$?="Enter Channel" | goto end }
  if [ %channel4 == $null ] { set %channel4  #$$?="Enter Channel" | goto end }
  if [ %channel5 == $null ] { set %channel5  #$$?="Enter Channel" | goto end }
  if [ %channel6 == $null ] { set %channel6  #$$?="Enter Channel" | goto end }
  if [ %channel7 == $null ] { set %channel7  #$$?="Enter Channel" | goto end }
  if [ %channel8 == $null ] { set %channel8  #$$?="Enter Channel" | goto end }
  if [ %channel9 == $null ] { set %channel9  #$$?="Enter Channel" | goto end }
  else { echo -a 4,15You Have Too Many Channels In Your List! | halt }
:end
echo -a 14»»»12 $! Has Been Added To Your Channel List
  


Not sure how to have each channel added to be joined on connect.
Posted By: Hammer Re: Inputs - 14/12/02 04:30 AM
Code:

on *:CONNECT: join %AutoJoin.Channels
alias addchannel {
  if ($numtok(%AutoJoin.Channels,44) < 11) {
    set %AutoJoin.Channels $addtok(%AutoJoin.Channels,#$$?="Enter Channel",44)
    echo -a »»» $gettok(%AutoJoin.Channels,-1,44) Has Been Added To Your Channel List
  }
  else echo -a »»» Your Channel List Is Already Full! $+($chr(40),$replace(%AutoJoin.Channels,$chr(44),$chr(32)),$chr(41))
}
alias delchannel {
  if ($istok(%AutoJoin.Channels,#$$1,44) {
    set %AutoJoin.Channels $remtok(%AutoJoin.Channels,#$1,1,44)
    echo -a #$1 Has Been Deleted From Your Channel List
  }
  else echo -a #$1 Is Not In Your Channel List
}

It should be noted that mIRC already has this functionality built right in, but for the sake of the discussion, I have shown a better way of implementing the idea using a single variable and tokens.
© mIRC Discussion Forums