Difference between revisions of "Message"

From Project X Wiki
Jump to: navigation, search
(Undo revision 1192 by DonaldTurner (talk) - Spam, Vandalism)
(minor updates)
Line 42: Line 42:
 
*Next we iterate through every [[CObject]] to find every worm, excluding the ones of the team that fired the mine.
 
*Next we iterate through every [[CObject]] to find every worm, excluding the ones of the team that fired the mine.
 
*In the last part we check the distance between the mine and each non-friendly worm, and if its close enough, activate the mine.
 
*In the last part we check the distance between the mine and each non-friendly worm, and if its close enough, activate the mine.
 +
 +
== The Story of Change ==
 +
 +
"Ive come to see that we have two parts to ourselves; its almost like two muscles -- a consumer muscle and a citizen muscle. Our consumer muscle, which is fed and exercised constantly, has grown strong: So strong that "consumer" has become our primary identity, our reason for being. Were told so often that were a nation of consumers that we dont blink when the media use "consumer" and "person" interchangeably."
 +
 +
[[http://goodvillenews.com/The-Story-of-Change-hgReTV.html The Story of Change]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== 6 Steps Towards Living a Life Free of Fear and Full of Hope ==
 +
 +
There are two basic motivating forces: fear and love. When we are afraid, we pull back from life. When we are in love, we open to all that life has to offer with passion, excitement, and acceptance. We need to learn to love ourselves first, in all our glory and our imperfections. If we cannot love ourselves, we cannot fully open our ability to love others or our potential to create. Evolution and all hopes for a better world rest in the fearlessness and open-hearted vision of people who embrace life. ~ John Lennon
 +
 +
[[http://goodvillenews.com/6-Steps-Towards-Living-a-Life-Free-of-Fear-and-Full-of-Hope-dnAp.html 6 Steps Towards Living a Life Free of Fear and Full of Hope]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== Happiness: Getting Our Priorities Straight ==
 +
 +
There is a vitally important shift underway in how we think about progress. Growing numbers of economists, political leaders and expert commentators are calling for better measures of how well society is doing; measures that track not just our economic standard of living, but our overall quality of life. We too can benefit from a shift in priorities and a recognition that real happiness is less about what we earn or own and more about our relationships and state of mind;
 +
 +
[[http://goodvillenews.com/Happiness-Getting-Our-Priorities-Straight-yQCEpG.html Happiness: Getting Our Priorities Straight]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== How To Speak More Wisely ==
 +
 +
It had been three weeks since my throat started to feel sore, and it wasnt getting better. The pain was most acute when I spoke. So I decided to spend a few days speaking as little as possible. Every time I had the urge to say something, I paused for a moment to question whether it was worth irritating my throat.
 +
 +
[[http://goodvillenews.com/How-To-Speak-More-Wisely-86itqo.html How To Speak More Wisely]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
 +
 +
== Celebrity Chef Chris Nirschel Cooks for the Homeless ==
 +
 +
Cause Celeb highlights a celebritys work on behalf of a specific cause. This week, Chris Nirschel shares with us, via email interview, his work with The Food Bank for New York City.After 28 years, The Food Bank for New York has become the citys major hunger relief organization and one of the largest food banks in the country.
 +
 +
[[http://goodvillenews.com/Celebrity-Chef-Chris-Nirschel-Cooks-for-the-Homeless-3xkuIL.html Celebrity Chef Chris Nirschel Cooks for the Homeless]]
 +
 +
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]

Revision as of 10:21, 9 August 2012

Up one category:
CObject
void CObject::Message(CObject *sender, EMType Type, int MSize, CMessageData *MData);

The Message function is one key element in the process of scripting.

This function is invoked for every CObject class and derivate objects each time an "event" occurs in the game, the nature of which is determined by variable EMType Type.

Overriding this function allows you to program objects and general game behaviour when certain "events" take place.

In the next example we override the function Message of class CMine, to make a "friendly" mine:

override void CMine::Message(CObject* sender, EMType Type, int MSize, CMessageData* MData)
{
 super;
 if (Type != M_FRAME) return;
 
 for (local i = 1; i < Env->Objs.Count - 1; i+=1)
 {
   local obj = Env->Objs.Objs[i];
   
   if (obj == NullObj) continue;
   if (obj->ClType != OC_Worm) continue;
   
   local worm = CWorm(obj);
   if (ShootData.Team == worm->WormTeam) continue;
   
   
   
   if (DistBetweenObjs(obj, this) < 65)
   {
     PrintMessage(111);
     Active = 1;
     nPulses = 1;
     break;
   }; 
 };
};
  • In this override, we first execute the original function, then we check if Type is equal to M_FRAME, such message is sent to every CObject once per physics step, for other message types, see EMType.
  • If the condition is not true, then we call operator return, because we only want to override the function when we receive a M_FRAME type message.
  • Next we iterate through every CObject to find every worm, excluding the ones of the team that fired the mine.
  • In the last part we check the distance between the mine and each non-friendly worm, and if its close enough, activate the mine.

The Story of Change

"Ive come to see that we have two parts to ourselves; its almost like two muscles -- a consumer muscle and a citizen muscle. Our consumer muscle, which is fed and exercised constantly, has grown strong: So strong that "consumer" has become our primary identity, our reason for being. Were told so often that were a nation of consumers that we dont blink when the media use "consumer" and "person" interchangeably."

[The Story of Change]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

6 Steps Towards Living a Life Free of Fear and Full of Hope

There are two basic motivating forces: fear and love. When we are afraid, we pull back from life. When we are in love, we open to all that life has to offer with passion, excitement, and acceptance. We need to learn to love ourselves first, in all our glory and our imperfections. If we cannot love ourselves, we cannot fully open our ability to love others or our potential to create. Evolution and all hopes for a better world rest in the fearlessness and open-hearted vision of people who embrace life. ~ John Lennon

[6 Steps Towards Living a Life Free of Fear and Full of Hope]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Happiness: Getting Our Priorities Straight

There is a vitally important shift underway in how we think about progress. Growing numbers of economists, political leaders and expert commentators are calling for better measures of how well society is doing; measures that track not just our economic standard of living, but our overall quality of life. We too can benefit from a shift in priorities and a recognition that real happiness is less about what we earn or own and more about our relationships and state of mind;

[Happiness: Getting Our Priorities Straight]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

How To Speak More Wisely

It had been three weeks since my throat started to feel sore, and it wasnt getting better. The pain was most acute when I spoke. So I decided to spend a few days speaking as little as possible. Every time I had the urge to say something, I paused for a moment to question whether it was worth irritating my throat.

[How To Speak More Wisely]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]

Celebrity Chef Chris Nirschel Cooks for the Homeless

Cause Celeb highlights a celebritys work on behalf of a specific cause. This week, Chris Nirschel shares with us, via email interview, his work with The Food Bank for New York City.After 28 years, The Food Bank for New York has become the citys major hunger relief organization and one of the largest food banks in the country.

[Celebrity Chef Chris Nirschel Cooks for the Homeless]

[GoodvilleNews.com - good, positive news, inspirational stories, articles]