mIRC Home    About    Download    Register    News    Help

Print Thread
#35218 09/07/03 08:46 PM
Joined: Jul 2003
Posts: 16
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2003
Posts: 16
dialog new_table {
title "Conectar al SerVer"
size -1 -1 305 127
option dbu
text "VerDuGo Team 2003", 6, 7 95 206 8, disable nowrap
button "Aceptar", 7, 252 106 37 12, flat ok
tab "Conexion", 3, 2 7 297 114
text "SerVer:", 2, 9 35 32 8, tab 3
edit %server, 4, 39 34 194 10, tab 3 | set %server
box "Conexion Server", 1, 4 23 293 83, tab 3
button "Conectar......", 10, 235 33 37 12, tab 3
tab "Ident & Mail", 5
text "Nombre ", 11, 7 27 25 8, tab 5
text "Mail", 12, 7 40 25 8, tab 5
edit %nombre, 13, 38 26 220 10, tab 5 | set %nombre
edit %mail, 14, 38 38 200 10, tab 5 | set %mail
text "IDENT:", 15, 7 56 25 8, tab 5
edit "", 16, 39 55 80 9, tab 5
tab "Nick Alternativos ", 8
text "Nick Alternativo", 17, 6 32 25 8, tab 8
edit "", 18, 43 31 197 10, tab 8
tab "Tab 4", 9
}

on 1:dialog:new_table:sclick:10: goto L1



:L1

.server %server

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
on 1:dialog:new_table:sclick:10:{
goto L1
:L1
.server %server
}

but in that script a goto loop isnt even necesary

also see:
/help goto loops
/help dialogs

Last edited by pheonix; 09/07/03 08:49 PM.

new username: tidy_trax
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Why don't you do something like:
Code:
dialog new_table {
 title "Conectar al SerVer"
 size -1 -1 305 127
 option dbu
 text "VerDuGo Team 2003", 6, 7 95 206 8, disable nowrap
 button "Aceptar", 7, 252 106 37 12, flat ok
 tab "Conexion", 3, 2 7 297 114
 text "SerVer:", 2, 9 35 32 8, tab 3
 edit "", 4, 39 34 194 10, tab 3
 box "Conexion Server", 1, 4 23 293 83, tab 3
 button "Conectar......", 10, 235 33 37 12, tab 3
 tab "Ident & Mail", 5
 text "Nombre ", 11, 7 27 25 8, tab 5
 text "Mail", 12, 7 40 25 8, tab 5 
 edit %nombre, 13, 38 26 220 10, tab 5 | set %nombre 
 edit %mail, 14, 38 38 200 10, tab 5 | set %mail 
 text "IDENT:", 15, 7 56 25 8, tab 5
 edit "", 16, 39 55 80 9, tab 5
 tab "Nick Alternativos ", 8
 text "Nick Alternativo", 17, 6 32 25 8, tab 8
 edit "", 18, 43 31 197 10, tab 8
 tab "Tab 4", 9
}

on *:DIALOG:new_table:sclick:10: {
  if (($did == 10) && ($did(4) == $null)) { halt }
  else { server $did(4) }
}

Last edited by SladeKraven; 09/07/03 09:11 PM.
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Thats not a goto loop. Agreed, goto is not necessary in that script, but it's still not a loop, it is a "jump" statement.

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
yes but, /help goto loops


new username: tidy_trax
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Yeah so? Thats not what he is using it for, he is using it to do a jump.

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
its still a goto loop smirk


new username: tidy_trax
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
No it isn't. Why is it each time you say something and are corrected you refuse to admit it? You swore $chr(29) was a ")" for example. YOU ARE WRONG. That is NOT a loop. You want the technical reason, since you fail to see the simple ones? A loop is defined as a series of operations contained in a conditional branch that is reexecuted until a given condition is satisfied at which point an unconditional jump is triggered to exit the loop. A goto is not the same as a loop. A goto statement is defined as an unconditional jump to a specified location.

They are not the same.

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
<sarcasm>
now codemastr knows more than the help file shocked
</sarcasm>
i dont care what you say,/help goto loops takes you to a place in the help file smirk


new username: tidy_trax
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Maybe you should try reading the helpfile:

The Goto command
The /goto command allows you to jump from one point in a script to another point.



Hmm that seems to be what I said. Where does that say "any use of goto is referred to as a loop"? Oh? It doesn't? Gee looks like you're wrong again.

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
/help goto loops can obviously only be referring to the goto command. so its called a goto loop otherwise the help file wouldnt take you anywhere when you type /help goto loops


new username: tidy_trax
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Heh whatever, live your life in ignorance, doesn't hurt me at all.

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Anyways..

I don't think youy understand the basics of a goto command, MaGoNeGrO. The labels (:<name>) are to be places within the {}'s of an alias, trigger, or event. They cannot be, however, assorted throughout the file randomly. They must be contained in a body of code.

I've notice both times u've used them, they are out of the body of code. Ex:
Code:
alias myalias {
  if ($$1 == 1) goto one
  else goto end
}
:one
/echo -a One!
:end


That will not work, but this however will:

Code:
alias myalias {
  if ($41 == 1) goto one
  else goto end
  :one
  /echo -a One
  :end
}


Just thought i'd clearify for ya. Keep everything in the "mother" or "parent" set of {}'s. grin


-KingTomato
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
im being ignorant?
last i knew it takes 2 to argue smirk


new username: tidy_trax
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
In this case, you are indeed choosing ignorance over knowledge. codemastr is quite correct (with one minor correction).

GOTO is an unconditional jump command - no excuses, just go to whichever label follows the command.

A loop is indeed defined as a sequence of commands which are repeated as a group, USUALLY with a conditional expression somewhere to determine when to end the loop. Not all loops have such conditional expressions.
Code:

alias oops {
  :TheStore
  GOTO TheStore
}

In this loop, there is no conditional expression at all; this is a valid loop, however foolish it might be.
Code:

alias blah {
  GOTO TheEnd
  :TheEnd
}

This example is not a loop at all; it is strictly an unconditional jump. It shows why GOTO is not a loop, nor even a looping mechanism, although it can be used as such.

Since the advent of the BASIC programming language, GOTO has been used and abused. It does have valid uses in every language, including mIRC scripting; however, it's far more well-known for its abuse which results in spaghetti programming that not even the programmer who wrote the code can follow. Boiled down to just the jump logic (if it can be called that), it can look like this:
Code:

alias huh? {
  GOTO Part-1
  :STOP
  :GOTO Please-STOP
  :Section-2
  GOTO STOP
  :Please-STOP
  GOTO OMG-STOP
  :Part-1
  GOTO Part-17a
  :OMG-STOP
  GOTO STOP-HALT-END
  :Part-17a
  GOTO Section-2
  :STOP-HALT-END
}

This is working code with no functionality. There's not a single loop anywhere in it. "Back in the day," GOTO commands jumped to line numbers which were even more obscure to read and debug than human-readable labels. Add in all the other (sometimes poor) code that goes into the program and things can get very difficult indeed to debug.

From versions.txt:

Code:
02/02/2000 - mIRC v5.7
                     
54.Added support for while loops. Repeats a loop while the expression
   in brackets is true. Multiple while loops can be embedded. You can
   use /break to break out of the current loop. You can also use the
   /continue command to jump to the beginning of the loop.

As you can see, we didn't get while loops until relatively recently. The While Loops section was just added to what was already there; prior to 2 Feb 2000, we had no other looping mechanism, other than GOTO.

/help goto loops == /help /goto == /help aliases == /help brackets == /help while loops == /help /while == /help /return (etc.) Obviously, no two of the previous /help commands means precisely the same thing. Perhaps it might be more correct to suggest that the help target "Goto loops" be removed or reworded since looping is just one function that GOTO is used for; however, pointing to a label in a help file (albeit absolutely the best mIRC reference there is) as proof of some archaic programming construct's sole validity is ludicrous.

GOTO is more closely related to CONTINUE (go to the top of the loop now), BREAK (exit the loop and start processing with the first command after the loop) and RETURN (which is usually used to return a value, even if that value is $null) and even HALT ("goto end") than it is to WHILE.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i stand corrected grin


new username: tidy_trax

Link Copied to Clipboard