Author Topic: Why isn't Export(); working?  (Read 761 times)

I'm trying to make a friend system, I'm saying /friend namehere and it says Friend added etc, but whenever I load up the game again and say /friendlist again it won't echo back my friends.
Script:

Code: [Select]
function clCmdaddFriend($friend1)
{
        echo("Added friend " @ $friend1);
export("$friend1*","config/client/friends.txt"); //Problem is here, it won't create the .txt file, why?
       
}

function friendsList($friend1)
{
    echo("Friends: " @ $friend1);
}

(ClCmd is Truce's Client Cmd)

I'm trying to make a friend system, I'm saying /friend namehere and it says Friend added etc, but whenever I load up the game again and say /friendlist again it won't echo back my friends.
Script:

Code: [Select]
function clCmdaddFriend($friend1)
{
        echo("Added friend " @ $friend1);
export("$friend1*","config/client/friends.txt"); //Problem is here, it won't create the .txt file, why?
       
}

function friendsList($friend1)
{
    echo("Friends: " @ $friend1);
}

(ClCmd is Truce's Client Cmd)
I think it needs to have a :: system in the variable, like here:
export("$SSDD::prefs*",$SSDD::static::prefpath);

How do I make one, then?

I think it needs to have a :: system in the variable, like here:
export("$SSDD::prefs*",$SSDD::static::prefpath);


No. The problem here is this guy doesn't know how to script.

How do I make one, then?
$rp::health::animals::cats = 100;
export("$rp::health*","prefs.cs");

Also it should end in .cs not .txt

EDIT:
No. The problem here is this guy doesn't know how to script.
You replied while I was typing this reply, I didn't see that until after this reply.

No. The problem here is this guy doesn't know how to script.
Wait, I forgot, I thought you ment me.

Also, thanks DrenDran.
« Last Edit: October 17, 2010, 11:29:04 AM by Bloxxed »

Hey guys, I was wondering, in config/server/prefs.cs you see your admin's BLID's.
How would I make them show up in the .cs file export created?

I think it needs to have a :: system in the variable, like here:
export("$SSDD::prefs*",$SSDD::static::prefpath);


False. It does not require ::s. That just makes things easier to export.

I don't even know what the hell he's doing there.
Can you even add global variables as arguments?
Even if you can, the friend will always be the last one you added, one before that will be overwritten.

What purpose does this serve in the end anyways?

Two problems:

1) Evidently barely knows how to script, or worse, is copying a script from a similar language and hoping it works.
2) Is likely trying to create something that will probably be in RTB fairly soon.

As a solution to the first issue, try
Code: [Select]
function clCmdaddFriend(%friend)
{
    if($friends !$= "")
      $friends = 0;
    $friend[$friends--] = %friend;
    export("$friend*","config/client/friends.txt");       
}

function friendsList()
{
    for(%i=0; %i>$friends; %i++)
        echo($friend[%i]);
}

Three characters are wrong, as intentional sabotage and one extra one was added, each carefully placed within the logic of the code so that it is a logic error that will prevent it from functioning correctly but without showing up as an error to the compiler.

If you can correctly fix the logic errors, then you are good enough to make use of it. Otherwise, don't bother until you know more abot scripting.