mIRC Home    About    Download    Register    News    Help

Print Thread
#1219 12/12/02 02:04 AM
Joined: Dec 2002
Posts: 13
L
Lackey Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Dec 2002
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.

#1220 12/12/02 02:30 AM
Joined: Dec 2002
Posts: 111
F
Vogon poet
Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
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?
#1221 12/12/02 03:27 AM
Joined: Dec 2002
Posts: 208
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
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^

#1222 12/12/02 08:24 AM
Joined: Dec 2002
Posts: 13
L
Lackey Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Dec 2002
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?

#1223 12/12/02 01:08 PM
Joined: Dec 2002
Posts: 143
A
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
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

#1224 12/12/02 04:58 PM
Joined: Dec 2002
Posts: 13
L
Lackey Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Dec 2002
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.

Last edited by Lackey; 12/12/02 05:02 PM.
#1225 12/12/02 05:23 PM
Joined: Dec 2002
Posts: 143
A
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
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

#1226 14/12/02 03:55 AM
Joined: Dec 2002
Posts: 13
L
Lackey Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Dec 2002
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 14»»»12 $! Has Been Added To Your Channel List
  


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

#1227 14/12/02 04:30 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
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

Link Copied to Clipboard