Author Topic: Iban Explains it All  (Read 24236 times)

Thanks Iban!
Nice having you back BTW.


Add parents.
Are you talking about hierarchy? That's explained in Packages but I guess I can go into further detail.

I always need help with syntaxes.

Do you think you could add a document imparting some helpful knowledge on them?

I always need help with syntaxes.

Do you think you could add a document imparting some helpful knowledge on them?
There is a piece on operators. What specifically do you want to know about syntax?

There is a piece on operators. What specifically do you want to know about syntax?
For example, things like setting up case statements, pseudo-arrays, hash tables, and for/if statements. Anything generally useful.

For example, things like setting up case statements, pseudo-arrays, hash tables, and for/if statements. Anything generally useful.
Well, arrays have already been covered, but when I get a chance I'll cover syntax.

Well, arrays have already been covered, but when I get a chance I'll cover syntax.
Thanks


How do you get your console.log to write every function that is executed and the arguments that go with it?

trace(1);

trace(0);
to deactivate.

Is there a way for the script to check if a certain action has been completed, then do another action?

For example:
Code: [Select]
function DoSomething(%var1)
{
for(%i=0;%i<%var1;%i++)
{
ServerCmdSomething(Parameters);
ServerCmdSomethingElse(Parameters);
}
}
I want it to say "The variable %i is currently (x)" after it has completed the specified actions the specified number of times.

So I would type:
Code: [Select]
echo("The variable %i is currently" SPC %i);
But, where would I put it?


If I put it here...
Code: [Select]
function DoSomething(%var1)
{
for(%i=0;%i<%var1;%i++)
{
ServerCmdSomething(Parameters);
ServerCmdSomethingElse(Parameters);
                echo("The variable %i is currently" SPC %i);
}
}
...it wouldn't work.

If I typed DoSomething(5); into the console with this code, the feedback I would get is

The variable %i is currently 1
The variable %i is currently 2
The variable %i is currently 3
The variable %i is currently 4

So how do I make this so that the feedback would be only, for example, "The variable %i is currently 5"?

Any help is appreciated.

I'm having trouble understanding what it is that you want.
If you're doing a for loop and want to know how many times the loop was ran, just do this.

Code: [Select]
function doLoop()
{
for(%a = 0; getRandom(0, 50) > 0; %a++) { }
echo("%a = " @ %a);
}

In this example, the loop will run forever, or until the getRandom() function returns a 0.
After the loop terminates (assuming it ever does), it echos %a. If I wanted to report how many times the for loop actually ran, I can either echo %a + 1 or start the for loop with %a = 1;.
« Last Edit: March 03, 2011, 08:59:16 PM by Iban »

I'm having trouble understanding what it is that you want.
If you're doing a for loop and want to know how many times the loop was ran, just do this.
I'm asking how to make the echo not actually part of the loop.

So that when the loop ends of its own accord, the action will happen once, only once, and only after the loop terminates.

It isn't necessarily an echo, that's just an example. It could be another function, or a variable statement, or anything, really.

The whole cat/datablock comparison really helped me understand how datablocks work better. :D