Particle's Custom RPG

Assistance => Assistance & Feedback => Topic started by: bigbigger9 on August 17, 2003 01:22 am CDT

Title: Functions too large?
Post by: bigbigger9 on August 17, 2003 01:22 am CDT
I'm making a quest all in a function on another server, but I have to split it up into many functions because Tribes isn't loading it just in all one big one? I've done scripting for Tribes before, just never as a quest for TRPG... any ideas on what the problem is? If I put it all in a .cs by itself, Tribes says the .cs doesn't exist, if I stick it in the autoexec.cs, Tribes just doesn't load it at all and says Unknown command when I try it. (it loads the rest of the stuff though, just not the long function)

By the way, this is kind of what it's like, just longer:
Code: [Select]
function quest(%part)
{
   if(%part == "build")
   {
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
       say(0, "#spawndis blah blah");
   }

   if(%part == "elves")
   {
       say(0, "#spawn blah blah");
       say(0, "#spawn blah blah");
       say(0, "#spawn blah blah");
       say(0, "#spawn blah blah");
       say(0, "#spawn blah blah");
       say(0, "#spawn blah blah");
       say(0, "#spawn blah blah");
   }
}


And with the correct #spawn stuff, and more if(blahblah)s.

Hope someone can help.
Title:
Post by: eViL on August 17, 2003 01:28 am CDT
usually if there is more than 50 if's or else if's in 1 function, it won't load right, but by that, i mean:

Code: [Select]
function Build(%Part)
{
if(%Part == "part1")
{ }
else if(%Part == "part2")
{ }
// etc...
}

but you could do something like:

Code: [Select]
function Build(%Part, %Sub)
{
if(%Part == "part1")
{
if(%Sub == "sub1")
{ }
else if(%Sub == "sub2")
{ }
// etc.
}
else if(%Part == "part2")
{
if(%Sub == "sub1")
{ }
else if(%Sub == "sub2")
{ }
// etc.
}
// etc.
}


both will work but the second one will hold more information.
Title:
Post by: bigbigger9 on August 17, 2003 01:38 am CDT
It's not more then 50 Ifs, more then 5 and it won't load for me.
Title:
Post by: eViL on August 17, 2003 01:47 am CDT
that sounds more like either a syntax error or you are overwriting an existing function...
Title:
Post by: bigbigger9 on August 17, 2003 02:55 am CDT
It would tell me if it was a syntax error, and if I was overwriting an existing function, then one of them would still work, the function I'm trying to put is in being ignored all together.
Title:
Post by: eViL on August 17, 2003 03:49 am CDT
lol, because you are executing it too early then...

somewhere else in tribes an existing function is already in place with its same name and is being executed after yours, so it is overwriting yours, which would make it non-existant :)
Title:
Post by: bigbigger9 on August 17, 2003 06:48 am CDT
I execute it during gameplay, after TRPG has loaded, and I'm in the game, and it'll still ignore it.

Edit: -Later-

I tried it with a very distinct name, function quest::12q234234. Still didn't work.

If I take out my function that you say gets over write and then left blank, then the one that's overwriting it should stay. But it doesn't, it still comes back Unknown Command.
Title:
Post by: bigbigger9 on August 19, 2003 11:55 pm CDT
Well, here's my theory to what was causing this:

Tribes builds a list of the files in your config folder, and you can only execute those files, so if you make a script while Tribes is running, or change it's name, it won't know it's there because it's not in Tribes' list.

So, the solution, just restart Tribes with the script there with that name, and it won't work.

If it's not working in the autoexe.cs, you have a syntax error, and it just doesn't tell you.

Currently, this theory is holding true, we'll see if it holds out though.
Title:
Post by: UnderGod on August 20, 2003 03:01 am CDT
Tribes needs to register all the files in the config folder before you can execute them..

That gives you the file doesn't exist error.

The other one from your autoexec is a syntax error.

Maybe show some code so you can be helped instead of playing childish guessing games?
Title:
Post by: bigbigger9 on August 20, 2003 06:35 am CDT
Kind of late UnderGod.  :P