You are not logged in.    Login    New User    Forum Home    Search

Location:
JBPLAY  \  Meteor 2  \  Help and Guidance  \  i need scripting help!

Back to Threads

Viewing Thread: i need scripting help!

 

mr_no_name
Joined: 24 November 2007
Posts: 11
21 December 2007 03:16 (UK time)

wuts wrong in the scripting? i can't figure it out...

#title ""
#author ""

#include meteor2

export OnWaypointReached_21;

void OnWaypointReached_21()
{
int NewObjectId

//make blobs
NewObjectId = SC_AddObject( "blob.ob", 547, 1799, -1, AI_ROAMING, 4, "", 1, 0, 0);

//bind to track point to make more blobs
SC_BindObjectToWaypoint( NewObjectId, 21);
}

or this one:

#title ""
#author ""

#include meteor2

export OnWaypointReached_21;

void OnWaypointReached_21()
{

int NewObjectId

if( SC_ObjectExists(10) == 1)
{
//make blobs
NewObjectId = SC_AddObject( "blob.ob", 547, 1799, -1, AI_ROAMING, 4, "", 1, 0, 0);

//bind to track point to make more blobs
SC_BindObjectToWaypoint( NewObjectId, 21);
}
}

Edited: 21 December 2007 08:41


You need to login to create posts in this thread.

mike323
Joined: 23 January 2005
Posts: 745
21 December 2007 20:33 (UK time)

You tell us. What is it doing? (Or not doing?)

You need to login to create posts in this thread.

Canuck

Joined: 31 August 2007
Posts: 419
21 December 2007 21:59 (UK time)

Maybe try this

void OnWaypointReached_21(int ObjectId)

instead of


void OnWaypointReached_21()

I'm not even sure if you even have to do this, but I usually do, it might help.

You need to login to create posts in this thread.

mr_no_name
Joined: 24 November 2007
Posts: 11
22 December 2007 02:22 (UK time)

to canuck: oh i figured out wut was wrong, i forgot to add ; at the end of int NewObjectId... but thers still something wrong with this one:

#title
#author

#include meteor2

export OnWaypointReached_21;

void OnWaypointReached_21()
{

int NewObjectId;

if( SC_ObjectExists(10) == 1)
{
//make blobs
NewObjectId = SC_AddObject( blob.ob, 547, 1799, -1, AI_ROAMING, 4, , 1, 0, 0);

//bind to track point to make more blobs
SC_BindObjectToWaypoint( NewObjectId, 21);
}
}

Edited: 22 December 2007 02:29


You need to login to create posts in this thread.

mr_no_name
Joined: 24 November 2007
Posts: 11
22 December 2007 02:25 (UK time)

to mike: Okay, so first, i made a blob go to a waypoint (ID 21), and then make more blobs once it gets to that waypoint, using the script... but I fixed the first script, but the second one never works (the second script is in the last post i did)

Edited: 22 December 2007 02:28


You need to login to create posts in this thread.

nyasudah
 Official Sponsor

Joined: 06 February 2005
Posts: 832
22 December 2007 05:48 (UK time)

you have to activate the script each time after you use it
i know thers somewhere a script command for it

i found it:
...............
void SC_SetSectorTriggerEnabled( int SectorId, int value);
Once a sector trigger is used it is disabled by default (so it won't run again). Using this function a sector's trigger can be re-enabled (or disabled for that matter).

Notes
Setting a sector's required item in the Map Editor also affects if scripts are run (this is not for doors only).

Example
if( SC_GetItemCount("Hot Dinner";) < 300)
{
SC_GameMessage("You need 300 hot dinners to make this script work!";);

// re-enable this trigger for next time
SC_SetSectorTriggerEnabled(10,1);

......................

though its sector based, so you have to use one somehow
i leave this one to you..

i hope it helps
nyasudah / masuda / mp / PetiX / PtX


Edited: 22 December 2007 05:53


You need to login to create posts in this thread.

Dthdealer

Joined: 10 March 2007
Posts: 476
04 January 2008 08:17 (UK time)

I thought variables were a no-no in M2. Guess not.
But then why do we need StaticFlags?

Also known as Veyrdite
My website: http://halestrom.net/darksleep@Occasionally you may meet me when you sleep. In the darkest corners of your dreams, where your phone stops working and you don't know what to do. I'll be there; telling you that I don't support your device.

"Can't you just fix-"
NO! I told you when you bought this, when it goes wrong I can't fix it. It's filled with glue. The Greek goddess of glue Araldities herself would be impressed with this.

Please stop asking me for technical support during your dreams. Can't we just tour some surreal landscapes instead?

"How do I do that?"

Count your fingers. Keep trying. Make sure there's ten.

Then summon me. I am large and covered in wires. Clouds of baking soda pour into your world and a slightly weak yellowy glow appears from the LED strips behind me.

If you can see this message then you're already part of the way there. Keep all your styles disabled and you might see the dream within.

"But there's so much javascript everywhere! I can't see you. Help! I've forgotten to count my fingers! Where do I find them?"

The LED strip behind me pops and goes out. Dark spots appear in the centre of each light. I lift my finger to my lips. The smell of tantalum capacitors fills the air.

Ssh. Don't worry about that. Behind those frameworks there's another person sleeping.

Some day the javascript will sleep too.


You need to login to create posts in this thread.

DarkRain

Joined: 01 March 2007
Posts: 1193
04 January 2008 08:38 (UK time)

Good question. Why do we need static flags?
The Dark Age is upon us! Quake 2 mapmaker.


Edited: 04 January 2008 08:38


You need to login to create posts in this thread.

mike323
Joined: 23 January 2005
Posts: 745
06 January 2008 00:16 (UK time)

Static flags represent global int variables. James was telling me that, since you can't create global vars in .SC files, StaticFlags is a great workaround.

You need to login to create posts in this thread.

DarkRain

Joined: 01 March 2007
Posts: 1193
06 January 2008 07:47 (UK time)

Oh, I understand now.
The Dark Age is upon us! Quake 2 mapmaker.


You need to login to create posts in this thread.

Dthdealer

Joined: 10 March 2007
Posts: 476
11 January 2008 04:01 (UK time)

I wouldn't have a clue what the difference is.
Also known as Veyrdite
My website: http://halestrom.net/darksleep@Occasionally you may meet me when you sleep. In the darkest corners of your dreams, where your phone stops working and you don't know what to do. I'll be there; telling you that I don't support your device.

"Can't you just fix-"
NO! I told you when you bought this, when it goes wrong I can't fix it. It's filled with glue. The Greek goddess of glue Araldities herself would be impressed with this.

Please stop asking me for technical support during your dreams. Can't we just tour some surreal landscapes instead?

"How do I do that?"

Count your fingers. Keep trying. Make sure there's ten.

Then summon me. I am large and covered in wires. Clouds of baking soda pour into your world and a slightly weak yellowy glow appears from the LED strips behind me.

If you can see this message then you're already part of the way there. Keep all your styles disabled and you might see the dream within.

"But there's so much javascript everywhere! I can't see you. Help! I've forgotten to count my fingers! Where do I find them?"

The LED strip behind me pops and goes out. Dark spots appear in the centre of each light. I lift my finger to my lips. The smell of tantalum capacitors fills the air.

Ssh. Don't worry about that. Behind those frameworks there's another person sleeping.

Some day the javascript will sleep too.


You need to login to create posts in this thread.

mike323
Joined: 23 January 2005
Posts: 745
24 January 2008 02:33 (UK time)

Global variables can be used anywhere, whereas normal variables can only be used on the same level as the one at which it was called.

So if you had:

int hello;

Callback1()
{
// hello can be used here
}

Callback2()
{
// hello can also be used here
}

Unlike if you created a normal variable:

Callback1()
{
int hello;
// hello can be used here
}

Callback2()
{
// hello cannot be used here
}

You need to login to create posts in this thread.

ParaSait

Joined: 26 June 2007
Posts: 1478
24 January 2008 17:32 (UK time)

Lol, I didn't even know that you can use vars in M2 level scripts XD

So if I get it right, the M2 scripting language is actually pure C++, and NOT just some kind of clone? If that is correct, it would open a lot of features for me and will be MUCH more simple to create special stuff =D


This link is dead. It's only still here because, err... yknow, it's some sort of... memorial.


Edited: 24 January 2008 17:32


You need to login to create posts in this thread.

nyasudah
 Official Sponsor

Joined: 06 February 2005
Posts: 832
24 January 2008 17:39 (UK time)

then you must be good at programming in C
nyasudah / masuda / mp / PetiX / PtX


You need to login to create posts in this thread.

DarkRain

Joined: 01 March 2007
Posts: 1193
25 January 2008 11:26 (UK time)

I know some things on Pascal but I know nothing about C++.
The Dark Age is upon us! Quake 2 mapmaker.


You need to login to create posts in this thread.

Dthdealer

Joined: 10 March 2007
Posts: 476
01 February 2008 07:51 (UK time)

http://www.jbgames.com/games/meteor2/docs/ScriptCommandsList.htm#Standard_C_Functions
M2 is C+ with some M2 only commands that are only recognized by the M2 engine.
Also known as Veyrdite
My website: http://halestrom.net/darksleep@Occasionally you may meet me when you sleep. In the darkest corners of your dreams, where your phone stops working and you don't know what to do. I'll be there; telling you that I don't support your device.

"Can't you just fix-"
NO! I told you when you bought this, when it goes wrong I can't fix it. It's filled with glue. The Greek goddess of glue Araldities herself would be impressed with this.

Please stop asking me for technical support during your dreams. Can't we just tour some surreal landscapes instead?

"How do I do that?"

Count your fingers. Keep trying. Make sure there's ten.

Then summon me. I am large and covered in wires. Clouds of baking soda pour into your world and a slightly weak yellowy glow appears from the LED strips behind me.

If you can see this message then you're already part of the way there. Keep all your styles disabled and you might see the dream within.

"But there's so much javascript everywhere! I can't see you. Help! I've forgotten to count my fingers! Where do I find them?"

The LED strip behind me pops and goes out. Dark spots appear in the centre of each light. I lift my finger to my lips. The smell of tantalum capacitors fills the air.

Ssh. Don't worry about that. Behind those frameworks there's another person sleeping.

Some day the javascript will sleep too.


Edited: 01 February 2008 07:52


You need to login to create posts in this thread.

arezey

Joined: 16 June 2005
Posts: 1599
04 February 2008 21:59 (UK time)

In fact, did you guys ever notice that StaticFlags also work between levels? =)

You need to login to create posts in this thread.

Dthdealer

Joined: 10 March 2007
Posts: 476
06 February 2008 07:39 (UK time)

...AWESOME. I never knew that. I'll keep that in mind.
Also known as Veyrdite
My website: http://halestrom.net/darksleep@Occasionally you may meet me when you sleep. In the darkest corners of your dreams, where your phone stops working and you don't know what to do. I'll be there; telling you that I don't support your device.

"Can't you just fix-"
NO! I told you when you bought this, when it goes wrong I can't fix it. It's filled with glue. The Greek goddess of glue Araldities herself would be impressed with this.

Please stop asking me for technical support during your dreams. Can't we just tour some surreal landscapes instead?

"How do I do that?"

Count your fingers. Keep trying. Make sure there's ten.

Then summon me. I am large and covered in wires. Clouds of baking soda pour into your world and a slightly weak yellowy glow appears from the LED strips behind me.

If you can see this message then you're already part of the way there. Keep all your styles disabled and you might see the dream within.

"But there's so much javascript everywhere! I can't see you. Help! I've forgotten to count my fingers! Where do I find them?"

The LED strip behind me pops and goes out. Dark spots appear in the centre of each light. I lift my finger to my lips. The smell of tantalum capacitors fills the air.

Ssh. Don't worry about that. Behind those frameworks there's another person sleeping.

Some day the javascript will sleep too.


You need to login to create posts in this thread.

DarkRain

Joined: 01 March 2007
Posts: 1193
06 February 2008 09:38 (UK time)

That fact was unknown for me too.
The Dark Age is upon us! Quake 2 mapmaker.


You need to login to create posts in this thread.



Forums system (C) 1999-2023 by James Bunting.

Terms of Use