Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help with my script
ooadrianoo Offline
Member

Posts: 82
Threads: 29
Joined: Apr 2012
Reputation: 0
#1
Need help with my script

Hello everyone,
this script doesn't work. "icounter" must be declared and expression must be in boolean type.

PHP Code: (Select All)
void OnStart()
{
int icounter 1;
}

void counter(string &in asStickyAreastring &in asBodyName)
{
if (
icounter 2) ++icounter
Here^ "icounter" should be declared
PHP Code: (Select All)
else GiveSanityBoostSmall();


I don't need to declare "icounter". I could be in boolean type but I don't know why it doesn't work this way.

Any suggestions?
(This post was last modified: 05-25-2013, 11:00 PM by ooadrianoo.)
05-25-2013, 10:41 PM
Find
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#2
RE: Need help with my script

icounter is a local variable, which is why the function counter does not recognize it.

EDIT: Also, it says your expression is not of type Boolean because icounter isn't declared, so it's meaningless. It's the same as saying: If three is less than banana then this.
(This post was last modified: 05-26-2013, 12:52 AM by Bridge.)
05-26-2013, 12:40 AM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#3
RE: Need help with my script

To make it a global variable (visible to every function) move it out of the OnStart() function. For example, like this:
PHP Code: (Select All)
int icounter 1;

void OnStart()
{
}

void counter(string &in asStickyAreastring &in asBodyName)
{
    if (
icounter 2) ++icounter
    else 
GiveSanityBoostSmall();

05-26-2013, 12:58 AM
Find
ooadrianoo Offline
Member

Posts: 82
Threads: 29
Joined: Apr 2012
Reputation: 0
#4
RE: Need help with my script

(05-26-2013, 12:58 AM)TheGreatCthulhu Wrote: To make it a global variable (visible to every function) move it out of the OnStart() function. For example, like this:
PHP Code: (Select All)
int icounter 1;

void OnStart()
{
}

void counter(string &in asStickyAreastring &in asBodyName)
{
    if (
icounter 2) ++icounter
    else 
GiveSanityBoostSmall();


Thanks! Now it works, you deserved a reputation Smile
05-26-2013, 04:53 PM
Find
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#5
RE: Need help with my script

http://omnigeek.robmiracle.com/2011/10/1...ogrammers/
05-26-2013, 06:30 PM
Find




Users browsing this thread: 1 Guest(s)