Author Topic: Calling A Function In A Function  (Read 1694 times)

How would you call another function in a function?

What are you make script?

What are you make script?
I do not understand your speech because your words are all mixed up.

Code: [Select]
function hi()
{
bye();
}
function bye()
{
echo("bye");
}
Is that what you mean?

Code: [Select]
function hi()
{
bye();
}
function bye()
{
echo("bye");
}
Is that what you mean?
More like:
Code: [Select]
function One(%client)
{
Two(%client);
//Do stuff
}

function Two(%client)
{
Delay somehow
One(%client);
}

Code: [Select]
function One(%client)
{
schedule(1000,0,"Two",%client);
//Do stuff
}

function Two(%client)
{
//delayed 1000 milliseconds
One(%client);
}

If you're only going to call the function you just came from then make it call itself:
Code: [Select]
function One(%client)
{
    schedule(1000, 0, One, %client);
}

If you're only going to call the function you just came from then make it call itself:
Code: [Select]
function One(%client)
{
    schedule(1000, 0, One, %client);
}
You can do that?

EDIT: Oh and is there a way to make the delay a variable for an RTB pref?
« Last Edit: October 10, 2011, 04:33:34 PM by jes00 »

You can do that?

EDIT: Oh and is there a way to make the delay a variable for an RTB pref?

Code: [Select]
$Mod::Time = 5000
//RTBPref
RTB_registerPref("Pref Name","Category","$Mod::Time","int 10000 50000", "Name","5000",0,0,);

if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Duplicator Timeout","Duplicator","Duplicator::Timeout","int 0 60","Tool_Duplicator",40,0,0);
}
else
{
$Mod::Time = 15000;


function One(%client)
}
   schedule($Mod::Time, 0, One, %client);
}

That should work for the RTB pref.

You can do that?

EDIT: Oh and is there a way to make the delay a variable for an RTB pref?
you can call the function itself, and make it recursive if you wanted

Code: [Select]
$Mod::Time = 5000
//RTBPref
RTB_registerPref("Pref Name","Category","$Mod::Time","int 10000 50000", "Name","5000",0,0,);

if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Duplicator Timeout","Duplicator","Duplicator::Timeout","int 0 60","Tool_Duplicator",40,0,0);
}
else
{
$Mod::Time = 15000;


function One(%client)
}
   schedule($Mod::Time, 0, One, %client);
}

That should work for the RTB pref.
But why are you registering the pref twice?

mp7964, you have no clue what you're doing, just stop posting code.

mp7964, you have no clue what you're doing, just stop posting code.
Mind helpin a bit Kalph?

Incase you don't already know, RTB Prefs are used to edit global variables. You can find out how to use them correctly here.

Code: [Select]
function One(%client)
}
   schedule($Pref::Mod::Time, 0, One, %client);
}
So would this be correct?