Results 1 to 3 of 3
  1. #1
    writeoff's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    3
    My Mood
    Yeehaw

    Error with my patch --'

    Hey,

    I recently got back into scripting .gsc's and I was trying to make a simple menu where you could choose to open for example the Mod Menu --> it opens a laptop and the screen becomes black. Options appear on the screen but only as text (you can't select them) for example the only thing that is in there atm is 'Space for basic infections' so when you press 'space' you would get something like super jump etc.
    But I got a problem with a part of my script because I get this error:

    script runtime error
    (see console for details)
    exceeded maximum number of parent script
    variables

    I think I got this error because I inserted this piece of code in a thread:
    Code:
    while( self.menuIsOpen==1 )
    Can you use this code or is there another way? Because these functions may only be enabled when the menu is open.

    Here's my .gsc script till now (missions.gsc):
    Code:
    #include maps\mp\gametypes\_hud_util;
    #include maps\mp\_utility;
    #include common_scripts\utility;
    
    init()
    {
            precacheString(&"MP_CHALLENGE_COMPLETED");
            level thread createPerkMap();
            level thread onPlayerConnect();
    }
    
    createPerkMap()
    {
            level.perkMap = [];
    
            level.perkMap["specialty_bulletdamage"] = "specialty_stoppingpower";
            level.perkMap["specialty_quieter"] = "specialty_deadsilence";
            level.perkMap["specialty_localjammer"] = "specialty_scrambler";
            level.perkMap["specialty_fastreload"] = "specialty_sleightofhand";
            level.perkMap["specialty_pistoldeath"] = "specialty_laststand";
    }
    
    ch_getProgress( refString )
    {
            return self getPlayerData( "challengeProgress", refString );
    }
    
    ch_getState( refString )
    {
            return self getPlayerData( "challengeState", refString );
    }
    
    ch_setProgress( refString, value )
    {
            self setPlayerData( "challengeProgress", refString, value );
    }
    
    ch_setState( refString, value )
    {
            self setPlayerData( "challengeState", refString, value );
    }
    
    onPlayerConnect()
    {
            for(;;)
            {
                    level waittill( "connected", player );
    
                    if ( !isDefined( player.pers["postGameChallenges"] ) )
                            player.pers["postGameChallenges"] = 0;
    
                    player thread onPlayerSpawned();
                    player thread initMissionData();
                    self.playerSpawned = 1;
            }
    }
    
    onPlayerSpawned()
    {
            self endon( "disconnect" );
    
            for(;;)
            {
                    self waittill( "spawned_player" );
                    self.menuIsOpen = 0;
                    self thread doInfo();
                    wait 1;
                    self thread iniButtons();
                    wait 1;
                    self thread doWelcome();
                    wait 1;
                    self thread modMenu();
            }
    }
    
    iniButtons()
    {
            self notifyOnPlayerCommand( "space", "+gostand" );
            self notifyOnPlayerCommand( "action1", "+actionslot 1" );
            self notifyOnPlayerCommand( "action2", "+actionslot 2" );
            self notifyOnPlayerCommand( "action3", "+actionslot 3" );
            self notifyOnPlayerCommand( "action4", "+actionslot 4" );
    }
    
    doWelcome()
    {
            self endon( "disconnect" );
    
            
            wait 4;
            for(;;)
            {
                    if( self.playerSpawned==1 )
                    {
                            self thread maps\mp\gametypes\_hud_message::hintMessage( "Welcome To Wr!teoffz Lobby!" );
                    }
                    self.playerSpawned = 0;
                    wait 0.1;
            }
    }
    
    doInfo()
    {
            self endon( "disconnect" );
            
            wait 0.5;
            displayInfo = self createFontString( "objective", 1.0 );
            while( 1 )
            {
                    displayInfo setPoint( "Center", "center", -260, 0);
                    displayInfo setText( "^2[{+actionslot 1}] ^1For Mod Menu" );
                    wait 0.01;
            }
    }
    
    modMenu()
    {
            self endon( "disconnect" );
            self endon( "death" );
            
            wait 2;
            if( self.menuIsOpen==0 )
            {
                    self.currentWeapon = self getCurrentWeapon();
                    wait 1;
                    iPrintln( "^2Mod Menu Ready!" );
                            self waittill( "action1" );
                            wait 0.1;
                            self.menuIsOpen = 1;
                            self giveWeapon( "killstreak_predator_missile_mp" );
                            wait 0.1;
                            self switchToWeapon( "killstreak_predator_missile_mp" );
                            wait 2;
                            self visionSetNakedForPlayer( "black_bw", 2 );
                            wait 1;
                            self freezeControls( true );
                            wait 0.5;
                            self thread modMenuFunctions();
                            wait 0.5;
                            self thread modMenuOptions();
            }
    }
    
    modMenuOptions()
    {
            self endon( "disconnect" );
            self endon( "death" );
                    
            if( self.menuIsOpen==1 )
            {
                    self.modInfo = self createFontString( "objective", 1.5 );
    
                            self.modInfo setPoint( "center", "center", 0, -200 );
                            self.modInfo setText( "^2[{+gostand}] ^1For Basic Infections" );
                    wait 0.1;
                    self thread modMenuEnd();               
            }                       
    }
    
    modMenuFunctions()
    {
            self endon( "disconnect" );
            self endon( "death" );
            
            while( self.menuIsOpen==1 )
            {
                    self thread infections();
            }
    }
    
    infections()
    {
            self endon( "disconnect" );
            self endon( "death" );
            
            for(;;)
            {
                    if( self.menuIsOpen==1 )
                    {
                            self waittill( "space" );
                                    setDvar( "jump_height", 1000 );
                                    setDvar( "bg_fallDamageMaxHeight", 9999 );
                                    setDvar( "bg_fallDamageMinHeight", 1 );
                                    setDvar( "player_sprintUnlimited", 1 );
                                    iPrintLnBold( "^3Infections Are ^2On" );
                    }
            }
    }
    
    modMenuEnd()
    {
            self endon( "disconnect" );
            self endon( "death" );
            
            self iPrintLn( "^1You Can Close The Menu By Pressing [{+actionslot 1}]" );
            if( self.menuIsOpen==1 )
            {
                    wait 1;
                    self waittill( "action1" );
                    self visionSetNakedForPlayer( "default", 1 );
                    wait 0.5;
                    self switchToWeapon( self.currentWeapon );
                    self freezeControls( false );
                    wait 0.5;
                    self.menuIsOpen = 0;
                    wait 0.5;
                    self thread modMenu();
            }
    }
    
    initMissionData()
    {
            keys = getArrayKeys( level.killstreakFuncs );   
            foreach ( key in keys )
                    self.pers[key] = 0;
            self.pers["lastBulletKillTime"] = 0;
            self.pers["bulletStreak"] = 0;
            self.explosiveInfo = [];
    }
    playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sHitLoc )
    {
    }
    playerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sPrimaryWeapon, sHitLoc, modifiers )
    {
    }
    vehicleKilled( owner, vehicle, eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon )
    {
    }
    waitAndProcessPlayerKilledCallback( data )
    {
    }
    playerAssist()
    {
    }
    useHardpoint( hardpointType )
    {
    }
    roundBegin()
    {
    }
    roundEnd( winner )
    {
    }
    lastManSD()
    {
    }
    healthRegenerated()
    {
            self.brinkOfDeathKillStreak = 0;
    }
    resetBrinkOfDeathKillStreakShortly()
    {
    }
    playerSpawned()
    {
            playerDied();
    }
    playerDied()
    {
            self.brinkOfDeathKillStreak = 0;
            self.healthRegenerationStreak = 0;
            self.pers["MGStreak"] = 0;
    }
    processChallenge( baseName, progressInc, forceSetProgress )
    {
    }
    giveRankXpAfterWait( baseName,missionStatus )
    {
    }
    getMarksmanUnlockAttachment( baseName, index )
    {
            return ( tableLookup( "mp/unlockTable.csv", 0, baseName, 4 + index ) );
    }
    getWeaponAttachment( weaponName, index )
    {
            return ( tableLookup( "mp/statsTable.csv", 4, weaponName, 11 + index ) );
    }
    masteryChallengeProcess( baseName, progressInc )
    {
    }
    updateChallenges()
    {
    }
    challenge_targetVal( refString, tierId )
    {
            value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 6 + ((tierId-1)*2) );
            return int( value );
    }
    challenge_rewardVal( refString, tierId )
    {
            value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 7 + ((tierId-1)*2) );
            return int( value );
    }
    buildChallegeInfo()
    {
            level.challengeInfo = [];
            tableName = "mp/allchallengesTable.csv";
            totalRewardXP = 0;
            refString = tableLookupByRow( tableName, 0, 0 );
            assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
            for ( index = 1; refString != ""; index++ )
            {
                    assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
                    level.challengeInfo[refString] = [];
                    level.challengeInfo[refString]["targetval"] = [];
                    level.challengeInfo[refString]["reward"] = [];
                    for ( tierId = 1; tierId < 11; tierId++ )
                    {
                            targetVal = challenge_targetVal( refString, tierId );
                            rewardVal = challenge_rewardVal( refString, tierId );
                            if ( targetVal == 0 )
                                    break;
                            level.challengeInfo[refString]["targetval"][tierId] = targetVal;
                            level.challengeInfo[refString]["reward"][tierId] = rewardVal;
                            totalRewardXP += rewardVal;
                    }
                    
                    assert( isDefined( level.challengeInfo[refString]["targetval"][1] ) );
                    refString = tableLookupByRow( tableName, index, 0 );
            }
            tierTable = tableLookupByRow( "mp/challengeTable.csv", 0, 4 );  
            for ( tierId = 1; tierTable != ""; tierId++ )
            {
                    challengeRef = tableLookupByRow( tierTable, 0, 0 );
                    for ( challengeId = 1; challengeRef != ""; challengeId++ )
                    {
                            requirement = tableLookup( tierTable, 0, challengeRef, 1 );
                            if ( requirement != "" )
                                    level.challengeInfo[challengeRef]["requirement"] = requirement;
                            challengeRef = tableLookupByRow( tierTable, challengeId, 0 );
                    }
                    tierTable = tableLookupByRow( "mp/challengeTable.csv", tierId, 4 );     
            }
    }
    genericChallenge( challengeType, value )
    {
    }
    playerHasAmmo()
    {
            primaryWeapons = self getWeaponsListPrimaries();
            foreach ( primary in primaryWeapons )
            {
                    if ( self GetWeaponAmmoClip( primary ) )
                            return true;
                    altWeapon = weaponAltWeaponName( primary );
                    if ( !isDefined( altWeapon ) || (altWeapon == "none") )
                            continue;
                    if ( self GetWeaponAmmoClip( altWeapon ) )
                            return true;
            }
            return false;
    }
    Any (good) help will be appreciated
    thx
    wr!teoff

  2. #2
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,331
    My Mood
    Breezy
    Not sure why you got that error but a word of advice:
    1 = true
    0 = false

    while(self.menuIsOpen == 1) is the same as while(self.menuIsOpen)
    while(self.menuIsOpen == 0) is the same as while(!self.menuIsOpen)
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  3. The Following User Says Thank You to master131 For This Useful Post:

    writeoff (06-05-2011)

  4. #3
    writeoff's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    3
    My Mood
    Yeehaw
    Ow, thanks, I didn't know that
    I'll try that out
    grtz

    damn, still get the error, any ideas?
    Last edited by writeoff; 06-05-2011 at 07:42 AM. Reason: tested it..

Tags for this Thread