Author Topic: Functions too large?  (Read 5313 times)

0 Members and 1 Guest are viewing this topic.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
Functions too large?
« 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.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #1 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.
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #2 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.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #3 on: August 17, 2003 01:47 am CDT »
that sounds more like either a syntax error or you are overwriting an existing function...
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #4 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.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #5 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 :)
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #6 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.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #7 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.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

UnderGod

  • Centurian Lord
  • ********
  • Posts: 2,691
  • Reputation: +0/-0
(No subject)
« Reply #8 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?
« Last Edit: December 31, 1969 06:00 pm CST by UnderGod »
"The right man in the wrong place can make all the difference in the world"

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #9 on: August 20, 2003 06:35 am CDT »
Kind of late UnderGod.  :P
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9