mIRC Home    About    Download    Register    News    Help

Topic Options
#1219 - 12/12/02 02:04 AM Inputs
Lackey Offline
Pikka bird

Registered: 12/12/02
Posts: 13
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.

Top
#1220 - 12/12/02 02:30 AM Re: Inputs
Frog Offline
Vogon poet

Registered: 09/12/02
Posts: 111
Loc: Hell
Have it set variables accordingly. eg: on *:input:*:if ($1 == bah) set %Bah value

..or something like that. Anyway
_________________________
Experience The Void.. Are You Ready?

Top
#1221 - 12/12/02 03:27 AM Re: Inputs
Cobra Offline
Fjord artisan

Registered: 07/12/02
Posts: 208
Loc: Ohio, USA
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^

Top
#1222 - 12/12/02 08:24 AM Re: Inputs
Lackey Offline
Pikka bird

Registered: 12/12/02
Posts: 13
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?

Top
#1223 - 12/12/02 01:08 PM Re: Inputs
Aubs Offline
Vogon poet

Registered: 10/12/02
Posts: 143
Loc: Sheffield, UK
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?!
_________________________
Aubs.
cool


Top
#1224 - 12/12/02 04:58 PM Re: Inputs
Lackey Offline
Pikka bird

Registered: 12/12/02
Posts: 13
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.


Edited by Lackey (12/12/02 05:02 PM)

Top
#1225 - 12/12/02 05:23 PM Re: Inputs
Aubs Offline
Vogon poet

Registered: 10/12/02
Posts: 143
Loc: Sheffield, UK
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
_________________________
Aubs.
cool


Top
#1226 - 14/12/02 03:55 AM Re: Inputs
Lackey Offline
Pikka bird

Registered: 12/12/02
Posts: 13
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 1412 $! Has Been Added To Your Channel List
  


Not sure how to have each channel added to be joined on connect.

Top
#1227 - 14/12/02 04:30 AM Re: Inputs
Hammer Offline
Hoopy frood

Registered: 07/12/02
Posts: 1321
Loc: Georgia, USA
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.
_________________________
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Top