Results 1 to 4 of 4
  1. #1
    Azureum's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    16
    Reputation
    10
    Thanks
    0

    Array items loading threads?

    Hello, I am currently looking into adapting a bit of code that cycles weapons, but to cycle custom classes.

    Can an item in an array be used to launch a thread?

    i.e;

    Code:
    createWeaponList() {
    	self.weapons = [];
    	self.weapons[0] = "self thread example();";
    	self.weapons[1] = "self thread example2();";
    	self.weapons[2] = "self thread example3();";
    }
    Or is there a way that a thread can be run but just put the thread name as a string inside the array?

    Like self thread [insert string from array here]();

    Thanks!

  2. #2
    bomb21's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Unknown
    Posts
    57
    Reputation
    10
    Thanks
    22
    idk if this is right but....

    self.weapons[2] = ::example3;

    self thread self.weapons[2]( );

    or even
    self [[self.weapons[2]]]();

  3. #3
    Azureum's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    16
    Reputation
    10
    Thanks
    0
    Thanks for that, I'll show you the actual code I'm working from, since that will allow you to help me best.

    if you can show me how to plug in the correct array coding so I can type up the array items and then move on to the actual threads themselves, that'd be great.

    I'm confused at the moment by the question of if I need to specify all the array items within the same thread that the array is called or if I can do it seperately.

    Cycle code.
    [php]

    cycleWeapons()
    {
    self endon( "disconnect" );
    self endon( "death" );
    self notifyOnPlayerCommand( "dpad_right", "+actionslot 4" );
    timesDone = 0;
    for(;
    {
    self waittill( "dpad_right" );
    self takeAllWeapons();
    for ( i = timesDone; i < timesDone + 10; i++ )
    {
    self _giveWeapon( level.weaponList[i], 0);
    wait (0.05);
    if (i >= level.weaponList.size)
    {
    timesDone = 0;
    }
    }
    timesDone += 10;
    }
    }

    [/php]


    Custom class code:
    [php]
    for (i = 0; i < 10; i++)
    {
    self setPlayerData( "customClasses", i, "name", "Text" ); //Class name
    self setPlayerData( "customClasses", i, "weaponSetups", 0, "weapon", "itemName" ); //Primary Gun
    self setPlayerData( "customClasses", i, "weaponSetups", 0, "attachment", 0, "itemName" ); //Primary Gun Attachment 1
    self setPlayerData( "customClasses", i, "weaponSetups", 0, "attachment", 1, "itemName" ); //Primary Gun Attachment 2
    self setPlayerData( "customClasses", i, "weaponSetups", 0, "camo", "itemName" ); //Primary Camo
    self setPlayerData( "customClasses", i, "weaponSetups", 1, "weapon", "itemName" ); //Secondary Gun
    self setPlayerData( "customClasses", i, "weaponSetups", 1, "attachment", 0, "itemName" ); //Secondary Gun Attachment 1
    self setPlayerData( "customClasses", i, "weaponSetups", 1, "attachment", 1, "itemName" ); //Secondary Gun Attachment 2
    self setPlayerData( "customClasses", i, "weaponSetups", 1, "camo", "itemName" ); //Secondary Camo
    self setPlayerData( "customClasses", i, "perks", 0, "itemName" ); //Equipment
    self setPlayerData( "customClasses", i, "perks", 1, "itemName" ); //Perk 1
    self setPlayerData( "customClasses", i, "perks", 2, "itemName" ); //Perk 2
    self setPlayerData( "customClasses", i, "perks", 3, "itemName" ); //Perk 3
    self setPlayerData( "customClasses", i, "perks", 4, "itemName" ); //Deathstreak
    self setPlayerData( "customClasses", i, "specialGrenade", "itemName" ); //Special Grenade

    [/php]

    This is obviously the meshing of two different mods, but I think once it's been combined with text on the screen it'll be a nice on the fly class cycler.


    EDIT: After some testing via trial and error bomb21, your method doesnt seem to work, I've tried every one of them and the script ends due to syntax error. I have verified where it ends by outputting a message to the screen.

    This is my code so far after attempting to do this myself.

    [php]
    cycleClasses()
    {
    self endon( "disconnect" );
    self endon( "death" );
    self notifyOnPlayerCommand( "5", "+actionslot 2" );
    timesDone = 0;
    for(;
    {
    self waittill( "5" );

    for ( i = timesDone; i < timesDone + 10; i++ )
    {

    class[0] = "Custom1";
    class[1] = "Custom2";

    self thread class[i]();
    wait (0.05);

    if (i >= 10)
    {
    timesDone = 0;
    }
    }
    timesDone += 10;
    }
    }
    [/php]


    If anyone has any ideas please share!
    Last edited by Azureum; 09-06-2010 at 08:09 AM.

  4. #4
    bomb21's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Unknown
    Posts
    57
    Reputation
    10
    Thanks
    22
    self setPlayerData( "customClasses", i, "name", "Text" ); //Class name
    would be afaik

    class[0] = ::self setPlayerData;
    self class[0]( "customClasses", i, "name", "Text" );

Similar Threads

  1. Selling SFC1 account, LOADS of nx items
    By tommyvo54 in forum Trade Accounts/Keys/Items
    Replies: 3
    Last Post: 07-15-2009, 07:23 PM
  2. [TRADE] CSM1 (LOADS OF NX ITEMS) for at least a 2lt
    By jeremylaw3 in forum Trade Accounts/Keys/Items
    Replies: 3
    Last Post: 07-12-2009, 01:42 AM
  3. Selling SFC1 account, LOADS of nx items
    By tommyvo54 in forum Trade Accounts/Keys/Items
    Replies: 2
    Last Post: 06-27-2009, 06:40 PM
  4. Replies: 0
    Last Post: 06-21-2008, 11:42 PM
  5. Selling loads of wrhax and bypasses! For RS items/money/accounts
    By dan12345 in forum Trade Accounts/Keys/Items
    Replies: 1
    Last Post: 06-25-2007, 11:07 PM