Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help uninitialised variable accomplishment
#1
Hi. I getan error uninitialised variable accomplishment.
It is my very first script, so it's normal to have obvius bugs or unnecessary code.
Could you help me?
Thanks in advance

It's about COD WaW but I post it here because there isn't a COD WaW section.

Code:
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_utility;

main()
{
correct = getent( "pass", "targetname" );
wrorgs = getentarray("wrong","targetname");

for(i=0; i<wrorgs.size; i++)
wrorgs[i] thread wrongs();

for(i=0; i<correct.size; i++)
correct[i] thread dartcheck();
}

dartcheck()
{
    while (1)
    {    
        self waittill("damage");

        if ( isDefined( accomplishment ) )
        {
            accomplishment = 0;
        }
        else
        {
        thread discover();
        }
        break;
        wait .05;
    }
}

wrongs()
{
    self waittill("damage");
    accomplishment = 0;
    iprintlnbold( "Wrong target! You are allowed to enter the secret room");
}

discover()
{
    iprintlnbold( "You discovered the secret!");
    wait .05;
    secret_door = getent( "secret_door", "targetname" );
    wait .05;
    secret_door MoveTo( secret_door.target, .5, 1, 1 );
}
[Image: 1nzceg.png]
Reply

#2
I have never got an accomplishment error, no idea.
Reply

#3
(03-27-2012, 20:10)Yamato Wrote: I have never got an accomplishment error, no idea.

The variable is accomplishment. not the error. I'll post a screenshot tommorow.
[Image: 1nzceg.png]
Reply

#4
(03-27-2012, 20:12)tsoPANos Wrote:
(03-27-2012, 20:10)Yamato Wrote: I have never got an accomplishment error, no idea.

The variable is accomplishment. not the error. I'll post a screenshot tommorow.

Ahhh lol, try this:

Code:
dartcheck()
{
accomplishment = 0; //set it to whatever, if it doesnt have value left it as = undefined;
while (1)
{
Reply

#5
You need to initialise the variable before using it:

if ( isDefined( accomplishment ) )
{
accomplishment = 0;
}

There you want to know if "isDefined( accomplishment )" that hasn't been uninitialised, just declare the variable first before using it.

Thanks Barata...
Don't worry if things aren't the way you planned, in the end everything will solve itself...
Reply

#6
Code:
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_utility;

main()
{
level.accomplishment = undefined;

correct = getent( "pass", "targetname" );
wrorgs = getentarray("wrong","targetname");

for(i=0; i<wrorgs.size; i++)
wrorgs[i] thread wrongs();

for(i=0; i<correct.size; i++)
correct[i] thread dartcheck();
}

dartcheck()
{
    while (1)
    {    
        self waittill("damage");

        if ( isDefined( level.accomplishment ) )
        {
            level.accomplishment = 0;
        }
        else
        {
        thread discover();
        }
        break;
        wait .05;
    }
}

wrongs()
{
    self waittill("damage");
    level.accomplishment = 0;
    iprintlnbold( "Wrong target! You are allowed to enter the secret room");
}

discover()
{
    iprintlnbold( "You discovered the secret!");
    wait .05;
    secret_door = getent( "secret_door", "targetname" );
    wait .05;
    secret_door MoveTo( secret_door.target, .5, 1, 1 );
}
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] Variable Zoom Scope Yamato 6 4,781 12-30-2011, 17:43
Last Post: GscGunner
  Help FIXED| static variable help | mfc c++ rotceh_dnih 1 2,012 11-19-2011, 05:18
Last Post: rotceh_dnih
Exclamation Help Time Variable Scripts18 4 3,256 07-29-2011, 02:17
Last Post: Scripts18
  Help uninitialised variable[SOLVED] ddaavvee 10 6,320 07-03-2011, 23:10
Last Post: ddaavvee
  why uninitialised variable 'cardicon_expert_fal' bougar 1 1,556 06-23-2011, 11:11
Last Post: met94
Exclamation Help With KILLSTREAK'S: variable true Please assist :) rotceh_dnih 19 9,363 04-05-2011, 16:01
Last Post: Tomsen1410

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.