|
Aug 25, 2007 2:31am
Aqua Dragon
4157 posts
|
Whats The Code For SOmething Like
If Position Is Empty
{
(Blahblahblah)
}
What I Want To Know Is What Is THe Code For The "If Position IS Empty". I'm Just Starting To LEarn Code So Please Help ^_^
|
|
|
|
|
Aug 25, 2007 2:35am
rogerrog
3599 posts
|
Place_Free (x,y)
There is something like "Place_Empty(x,y), but I don't know what's the differents so I use Place_Free(x,y)
I'm back....for now
|
|
|
|
|
Aug 25, 2007 2:41am
Aqua Dragon
4157 posts
|
if Acard = 1
if position_empty(16,16);
{
instance_create(16,16,A)
}
if Acard = 2
if position_empty(144,16);
{
instance_create(144,16,A)
}
if Acard = 3
if position_empty(272,16);
{
instance_create(272,16,A)
}
if Acard = 4
if position_empty (400,16);
{
instance_create(400,16,A)
}
if Acard = 5
if position_empty(528,16);
{
instance_create(528,16,A)
}
if Acard = 6
if position_empty(16,176);
{
instance_create(16,176,A)
}
if Acard = 7
if position_empty(144,176);
{
instance_create(144,176,A)
}
if Acard = 8
if position_empty(400,176);
{
instance_create(400,176,A)
}
if Acard = 9
if position_empty(528,176);
{
instance_create(528,176,A)
}
if Acard = 10
if position_empty(16,336);
{
instance_create(16,336,A)
}
if Acard = 11
if position_empty(144,336);
{
instance_create(144,336,A)
}
if Acard = 12
if position_empty(272,336);
{
instance_create(272,336,A)
}
if Acard = 13
if position_empty(400,336);
{
instance_create(400,336,A)
}
if Acard = 14
if position_empty(528,336);
{
instance_create(528,336,A)
I Don't GEt It. The Variable Is Named "Acard" (The Name Of The Monster Is "a") And This SHould Create 14 Of Them IN 14 Different Positions But Instead It Keeps On Creating Them Every Single Second (Even On Spots They Are Already On). I Only Want It To Create It Where They Aren't. How Come? (If I Dind't Explain It Enough I'll Break It Down More)
|
|
|
|
|
Aug 25, 2007 2:47am
Aqua Dragon
4157 posts
|
Oh, And Whats The Code For Exiting An Event?
|
|
|
|
|
Aug 25, 2007 2:51am
rogerrog
3599 posts
|
Code "For Exiting An Event" is exit
I'm still trying to figure out "position_empty"
I'm back....for now
|
|
|
|
|
Aug 25, 2007 2:54am
Aqua Dragon
4157 posts
|
Even worse, I ran The Game On Debug Mode And Checked Some Variables. The Variables Were Working Fine, However, For SOme Reason All 14 "A" That I Want To Appear All Appear At The Same Time (I Ran It AT 1 Room Speed). That Code Should Prevent More Then 1 Appearing At A Time. The Variable Randomizes Itself And It Was. It Was Going Perfectly Fine. Something Is Wrong With This Code But I don't Know What. o_O
And Thanks For That "exit" Thing Roger
|
|
|
|
|
Aug 25, 2007 2:56am
Aqua Dragon
4157 posts
|
Something Is Wrong. I Globalized Something Called "Alimit"."Alimit" INcreases By 1 Everytime An "A" is Made In Order To Make Sure Only 2 "A" Can Even BE There Or The Code WOuld Exit Itself
if Alimit = 2
{
exit
}
if Acard = 1
if position_empty(16,16);
{
instance_create(16,16,A)
}
if Acard = 2
if position_empty(144,16);
{
instance_create(144,16,A)
}
if Acard = 3
if position_empty(272,16);
{
instance_create(272,16,A)
}
if Acard = 4
if position_empty (400,16);
{
instance_create(400,16,A)
}
if Acard = 5
if position_empty(528,16);
{
instance_create(528,16,A)
}
if Acard = 6
if position_empty(16,176);
{
instance_create(16,176,A)
}
if Acard = 7
if position_empty(144,176);
{
instance_create(144,176,A)
}
if Acard = 8
if position_empty(400,176);
{
instance_create(400,176,A)
}
if Acard = 9
if position_empty(528,176);
{
instance_create(528,176,A)
}
if Acard = 10
if position_empty(16,336);
{
instance_create(16,336,A)
}
if Acard = 11
if position_empty(144,336);
{
instance_create(144,336,A)
}
if Acard = 12
if position_empty(272,336);
{
instance_create(272,336,A)
}
if Acard = 13
if position_empty(400,336);
{
instance_create(400,336,A)
}
if Acard = 14
if position_empty(528,336);
{
instance_create(528,336,A)
The Problem Still Persists. 14 Continue Appearing All At The Same Time. Does Anyone Know Why?
|
|
|
|
|
Aug 25, 2007 2:57am
rogerrog
3599 posts
|
But watch out, you may exit the event, but you don't exit the whole event, like if you have a script and then some D&D in the same spot. It will only exit the script and not the D&D
I'm back....for now
|
|
|
|
|
Aug 25, 2007 2:59am
Aqua Dragon
4157 posts
|
None Of The DND Creates "A". That Code Is The Only Thing That Creates Them. The REst Is Just SEtting Up Variables And STuff
|
|
|
|
|
Aug 25, 2007 11:32am
Trollspla...
2943 posts
|
if position_empty(16,16);
{
instance_create(16,16,A)
}
does this:
if position_empty(16,16)
{
;
}
{
instance_create(16,16,A)
}
Remove the ";" and thee shalt be rid of thy problems :)
I would recommand a switch-statement for this situation:
switch(Acard)
{
case 1: ...
case 2: ...
...
}
Take a look at it in the help-file.
Visit www.trollsplatterer.be for some files I made to help people out.
|
|
|
|
|
Aug 25, 2007 12:13pm
ConnMon
33 posts
|
how do just destroy an instance!
I put instance_detroy( )
but wht is wrong with it, it wants an assignment...
|
|
|
|
|
Aug 25, 2007 12:13pm
MT
3952 posts
|
You haven't told it what to destroy.
Get a Nifty userbar showing yo’ nerdiness (or lack thereof) Click
|
|
|
|
|
Aug 25, 2007 12:16pm
ConnMon
33 posts
|
I tried listing an object, and even 'self' or 'other' but it still doesnt work
|
|
|
|
|
Aug 25, 2007 12:18pm
MT
3952 posts
|
Well, i'm not good at code, so i can't help. I know
Instance_create
and
image_angle=direction
(not even sure if that is quite right)
Get a Nifty userbar showing yo’ nerdiness (or lack thereof) Click
|
|
|
|
|
Aug 25, 2007 1:34pm
Trollspla...
2943 posts
|
Quotehow do just destroy an instance!
I put instance_detroy( )
but wht is wrong with it, it wants an assignment...
"instance_destroy()" should destroy the current instance. It needs no argument and it doesn't have to be preceded with an instance.
Did you put this statement in a code-section or a script? It's probably something after or before the statement you did wrong.
Could you give us the complete code you wrote, or at least the part with the destroy-action in it?
Visit www.trollsplatterer.be for some files I made to help people out.
|
|
|
|
|
Aug 25, 2007 1:48pm
ConnMon
33 posts
|
ok, i just tried it. I make a person, Bob, and when his animation ends (about 1 second of frames) he should be detroyed. I put 'instance_destroy' in a code box. When i try to play it, it says:
FATAL ERROR in
action number 1
of Other Event: Animation End
for object bob:
COMPILATION ERROR in code action
Error in code at line 1:
instance_destroy
at position 16: Assignment operator expected.
|
|
|
|
|
Aug 25, 2007 1:48pm
ConnMon
33 posts
|
i dont need the code for something like that, but i need it for other things. There i could just D&D
|
|
|
|
|
Aug 25, 2007 2:45pm
NT
6160 posts
|
Quoteok, i just tried it. I make a person, Bob, and when his animation ends (about 1 second of frames) he should be detroyed. I put 'instance_destroy' in a code box. When i try to play it, it says:
FATAL ERROR in
action number 1
of Other Event: Animation End
for object bob:
COMPILATION ERROR in code action
Error in code at line 1:
instance_destroy
at position 16: Assignment operator expected.It's instance_destroy() even though there's nothing, you still need the ().

|
|
|
|
|
Aug 25, 2007 3:17pm
Trollspla...
2943 posts
|
() indicates it's a function. If you don't put the brackets, the compiler thinks it's a variable. Enter the brackets, like Nintendoteen says.
Visit www.trollsplatterer.be for some files I made to help people out.
|
|
|
|
|
Aug 25, 2007 7:40pm
ConnMon
33 posts
|
ive tried tht, and it STILL doesnt work. Same error as before
|
|
|
|
|
Aug 25, 2007 7:41pm
NT
6160 posts
|
Quoteive tried tht, and it STILL doesnt work. Same error as before
Are you putting the ()s?
It should be:
instance_destroy()

|
|
|
|
|
Aug 26, 2007 4:29am
Aqua Dragon
4157 posts
|
I'll Try What You Said.
And For The Instance Destroy, It Works Like This
instance_destroy(object)
Type In The Objects Name. If THe Object Has Spaces IN It's Name, Fill Them With _
|
|
|
|
|
Aug 26, 2007 4:35am
Aqua Dragon
4157 posts
|
if Alimit = 2
{
exit
}
if Acard = 1
if position_empty(16,16)
{
instance_create(16,16,A)
}
if Acard = 2
if position_empty(144,16)
{
instance_create(144,16,A)
}
if Acard = 3
if position_empty(272,16)
{
instance_create(272,16,A)
}
if Acard = 4
if position_empty (400,16)
{
instance_create(400,16,A)
}
if Acard = 5
if position_empty(528,16)
{
instance_create(528,16,A)
}
if Acard = 6
if position_empty(16,176)
{
instance_create(16,176,A)
}
if Acard = 7
if position_empty(144,176)
{
instance_create(144,176,A)
}
if Acard = 8
if position_empty(400,176)
{
instance_create(400,176,A)
}
if Acard = 9
if position_empty(528,176)
{
instance_create(528,176,A)
}
if Acard = 10
if position_empty(16,336)
{
instance_create(16,336,A)
}
if Acard = 11
if position_empty(144,336)
{
instance_create(144,336,A)
}
if Acard = 12
if position_empty(272,336)
{
instance_create(272,336,A)
}
if Acard = 13
if position_empty(400,336)
{
instance_create(400,336,A)
}
if Acard = 14
if position_empty(528,336)
{
instance_create(528,336,A)
I Tried It But Now The Opposite Problem has Arose. It Doesn't Create Anything At ALl. Any Idea Why?
|
|
|
|
|
Aug 26, 2007 4:40am
DarkFireG...
272 posts
|
Your scripting is WAY too sloppy. Clean it up some, and you'll be able to see what's wrong!
|
|
|
|
|
Aug 26, 2007 4:41am
Aqua Dragon
4157 posts
|
I Just Started Learning How To Do Code. What Do You Meaan By Sloppy?
|
|