Page 1 of 1

script problems

PostPosted: Sun May 25, 2008 8:29 pm
by Kooldudese
i've been having scripting problems which i dont get... to me it looks like it should work, ok heres the idea.

theres three buttons, there are mouse enters as events, and when they enter it changes the value of a variable called "char"

what it does is select what character you're using

ok, the problem is when you start the game,
the event on the button is the following:
mousedown "left",script editor:


{
if (char1p=1);
CreateActor("Naruto1", "Narutorightbreath1", "(none)", "(none)", 502, -1424, true);

if (char1p=2);
CreateActor("Sakura1", "Sakurarightbreath", "(none)", "(none)", 502, -1424, true);

if (char1p=3);
CreateActor("Sasuke1", "Sasukerightbreath", "(none)", "(none)", 502, -1424, true);
}

i have no clue why this doesnt work and i need your help to fix this problem i greatly appreciate it THX

Re: script problems

PostPosted: Sun May 25, 2008 8:43 pm
by stevenp
you say " when you start the game"

what do you mean by that? where is thiis event? in create actor? if it is, it wont work,

try putting it in the mouse down event

copy the { } script in each buton bu make sure that it is relative to the right place,

Re: script problems

PostPosted: Sun May 25, 2008 8:53 pm
by Kooldudese
when i say start game i mean, theres a button that says "start game" in the game itself, the even is on mouse button down (left)

Re: script problems

PostPosted: Sun May 25, 2008 8:59 pm
by stevenp
if you make a sample, or example, i can do it for you, because i cant see your code

Re: script problems

PostPosted: Sun May 25, 2008 9:05 pm
by Kooldudese
ill try to make a sample, using the same way. but its going to be completely different from my actuel game, gimme a sec

Re: script problems

PostPosted: Sun May 25, 2008 9:17 pm
by Kooldudese
hope you can help me fix this problem

Re: script problems

PostPosted: Sun May 25, 2008 10:07 pm
by stevenp
skip post

Re: script problems

PostPosted: Sun May 25, 2008 10:22 pm
by Kooldudese
well, i dont think this will help me because, im using variables,
ok heres the real layout,
you have to select a character,
it saves it in the variable,
and later on when you
"start the game"
it creates that actor,
it doesnt create the
actor the instant you
select it, so it has
to be a saved value.
and also, the button
pressed to create the
actors is one button
for the three actors.

Re: script problems

PostPosted: Sun May 25, 2008 10:33 pm
by stevenp
hows this?

Re: script problems

PostPosted: Sun May 25, 2008 10:47 pm
by Kooldudese
ty, this helps me alot

Re: script problems

PostPosted: Sun May 25, 2008 10:50 pm
by makslane
In the if commands, use == not =
Don't put a ; after the if.

So, instead:

Code: Select all
if (char1p=1);
    CreateActor("Naruto1", "Narutorightbreath1", "(none)", "(none)", 502, -1424, true);


Use:

Code: Select all
if (char1p==1)
    CreateActor("Naruto1", "Narutorightbreath1", "(none)", "(none)", 502, -1424, true);

Re: script problems

PostPosted: Sun May 25, 2008 11:47 pm
by Kooldudese
oh thx