Script problem

Non-platform specific questions.

Script problem

Postby Goettsch » Thu Aug 22, 2013 8:15 am

I am not so good in scripting,know someone what is wrong in this script

player>create actor>script editor
Code: Select all
launchbomb = 15;



key down>space>script editor
Code: Select all
launchbomb=launchbomb-1;

if (launchbomb>0);
{
CreateActor("bomb", "bomb", "(none)", "(none)", 0, 0, false);
}
Support me and open these links:
http://adf.ly/pZps0 (as many times as you can)
http://VisitsToMoney.com/index.php?refId=470333 (open once)
http://Visitors2Cash.com/ref.php?refId=169224 (open once)
My games:
Kingdoms of... http://adf.ly/pZq5O
Goettsch
 
Posts: 124
Joined: Fri Jun 28, 2013 10:00 pm
Score: 5 Give a positive score

Re: Script problem

Postby skydereign » Thu Aug 22, 2013 8:29 am

Goettsch wrote:I am not so good in scripting,know someone what is wrong in this script

You need to tell use the problem you are having. It could be several different things. If I were to guess, I'd say it is that the keydown event is set to repeat, and therefore you fire all 15 shots within half a second. To fix that set the event not to repeat, or use some form of timing condition. Another possibility is that it goes into negative ammo, which is undesirable. The fix for that is to put the first line that decrements launchbomb into the if statement. That way it won't reduce launchbomb when it doesn't fire a bomb.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Script problem

Postby Goettsch » Thu Aug 22, 2013 3:15 pm

skydereign wrote:I'd say it is that the keydown event is set to repeat, and therefore you fire all 15 shots within half a second.


It isn't this,I think it's the second case.
Support me and open these links:
http://adf.ly/pZps0 (as many times as you can)
http://VisitsToMoney.com/index.php?refId=470333 (open once)
http://Visitors2Cash.com/ref.php?refId=169224 (open once)
My games:
Kingdoms of... http://adf.ly/pZq5O
Goettsch
 
Posts: 124
Joined: Fri Jun 28, 2013 10:00 pm
Score: 5 Give a positive score

Re: Script problem

Postby lcl » Thu Aug 22, 2013 4:21 pm

Also, you are not supposed to have a ";" after if-statements.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Script problem

Postby Goettsch » Fri Aug 23, 2013 12:20 pm

lcl wrote:Also, you are not supposed to have a ";" after if-statements.


Thanks,but it works with the ; too.


Thanks sky I solved the problem.
Support me and open these links:
http://adf.ly/pZps0 (as many times as you can)
http://VisitsToMoney.com/index.php?refId=470333 (open once)
http://Visitors2Cash.com/ref.php?refId=169224 (open once)
My games:
Kingdoms of... http://adf.ly/pZq5O
Goettsch
 
Posts: 124
Joined: Fri Jun 28, 2013 10:00 pm
Score: 5 Give a positive score

Re: Script problem

Postby skydereign » Fri Aug 23, 2013 6:57 pm

Goettsch wrote:Thanks,but it works with the ; too.

It shouldn't work. By putting that after the if statement, the actor will always be created.
Code: Select all
if(x<0);
{
    // this will always run, even if x>=0
}

The semicolon stops the statement, and the following three lines are treated like a standard code block.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Script problem

Postby Goettsch » Sat Aug 24, 2013 10:47 am

Ahh,thanks
Support me and open these links:
http://adf.ly/pZps0 (as many times as you can)
http://VisitsToMoney.com/index.php?refId=470333 (open once)
http://Visitors2Cash.com/ref.php?refId=169224 (open once)
My games:
Kingdoms of... http://adf.ly/pZq5O
Goettsch
 
Posts: 124
Joined: Fri Jun 28, 2013 10:00 pm
Score: 5 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron