Author Topic: my addon won't work. can you help?  (Read 672 times)

//#############################################################################
//#      Gamereader - version 1.0
//#
//#   -------------------------------------------------------------------------
//#
//#      $Rev: 0 $
//#      $Date: 2011-04-20 03:41:30 +0000 (Wed, 04 Apr 2011) $
//#      $Author: Deathranger $
//#      $URL: N/A $
//#
//#      $Id: System_Gamereader.cs 0 2011-04-20 03:41:30Z Deathranger $
//#
//#   -------------------------------------------------------------------------
//#
//#   Game Handling
//#
//#############################################################################

//*********************************************************
//* Searching
//*********************************************************
if(!isObject(System_Gamereadercontrol))
{
   function Search(%file, %line, %this, %client)
   {
      {
         %file.openForRead("Add-Ons");
         if(isFile("Add-Ons/Game_*/") == true) {
            %file.openForRead("Add-Ons/Game_*/Game/Add-Ons");
            %file.selectall();
            %file.copy();
            %file.close();
         }
         %file.openForWrite("Add-Ons");
         %file.paste();
         %file.close();
      
         while(!%file.isEOF())
      {
         if(!isObject(%file)) {return;}
       %line = %file.readLine();
       if(%line $= "-1")
       {
         %this.variableFalse(%client);
       } else {
        if(getWord(%line, 0) $= %client.BL_ID)
        {
         %this.variableTrue(%client); 
        }
       }
      };

      //I know I said "Search" but it is kind of an instalation type of thing too, the above function part was for Add-Ons.

      %file.openForRead("Add-Ons/Game_*/Game/Build");
      %file.selectall();
      %file.copy();
      %file.close();
   }
   %file.openForWrite("Saves/Slate");
   %file.paste();
   %file.close();

   while(!%file.isEOF())
      {
         if(!isObject(%file)) {return;}
       %line = %file.readLine();
       if(%line $= "-1")
       {
         %this.variableFalse(%client);
       } else {
        if(getWord(%line, 0) $= %client.BL_ID)
        {
         %this.variableTrue(%client); 
        }
       }
   };

   %file.openForRead("Add-Ons/Game_*/Game/Minigame");
   %file.selectall();
   %file.copy();
   %file.close();
   {
      %file.openForWrite("config/client/MiniGameFavorites");
      %file.paste();
      %file.close();

   while(!%file.isEOF())
      {
         if(!isObject(%file)) {return;}
       %line = %file.readLine();
       if(%line $= "-1")
       {
         %this.variableFalse(%client);
       } else {
        if(getWord(%line, 0) $= %client.BL_ID)
        {
         %this.variableTrue(%client); 
        }
    }
   //This is only version one, there seems to be a small bug below, I will have to try to fix.
   }
}

need more info

what doesn't work?
do you get an error?
does blockland crash?
does your PC explode?

what happens?

I use torquedev 4 all my coding. it says the very last character has an error.


what
where do i need the ;

Add it to the end } and try it.

nope, and btw i started scripting like 5 months ago so u can call me a noob

I use torquedev 4 all my coding. it says the very last character has an error.
now that you give us a clue where to start looking...

the problem is here:
Code: [Select]
if(!isObject(System_Gamereadercontrol))
{
   function Search(%file, %line, %this, %client)

you cant have a function definition inside and if statement

i dont no how 2 fix that im a noob. can you help plz?

i dont no how 2 fix that im a noob. can you help plz?
go back to whoever gave you the script and start there

It is made from scratch by me

Why do I doubt that?

Why do I doubt that?

I'm sure he made it, but he probably looked at addons made by other people as reference.  I did the same thing when I started out.  Thanks Iban and Otis for indirectly teaching me scripting :D

100% correct, i looked at the %file crap from ephialtes rtb script