global variables
Posted: Sat Aug 06, 2005 9:26 am
how can I define global variables for a pawn that can be accessed by other pawns?
I never used it sriously, see the online docs...LevelController Scripting
There can be multiple level controllers in a script, each sharing the same script. (Pawns do not share their script. The Level Controller Entity does.) They can each have their own Start orders and can share global variables within the script. Level Controller scripts always run at a Low Level.
then the other scripts can obtain the value using the command GetAttribute("YourAttribute")[YourAttribute]
initial = <initial value>
low = <minimum value>
high = <maximum value>
Secondary scriptSetAttribute("YourAttribute", 1);
orif(GetAttribute("YourAttribute")=10)
{
do something;
}
note that the GetAttribute command is influenced by the self.ThinkTime variable. So if self.ThinkTime=0.1; then the script will read the Attribute 10x times in a second; if self.ThinkTime isn't set the GetAttribute command will be executed every frame influencing all the script execution because this is a red/write operation of the engine: it reads directly the file attribute.txt in your RF root folder.TORQUEFORCE=GetAttribute("YourAttribute");
this is a faster way to share an input between different pawns and scripts. Otherwise if you need to share numerical value you have to use the SetAttribute command. Remember that it works only with integer values. So if you want to share the variable APPLE=0.001 you have to do something like this:if(GetEventState("YourTrigger")=true)
{
do something;
}
Secondary scriptAPPLE=0.001;
SetAttribute("MyApple", APPLE*10000);
As I said, this command slows down all the scripts esecution. You probably should control it in some way. For example, in my tocco.s script in my Ping!DEMO1.3b (you can found it in my download page) I placed all the SetAttribute GetAttribute commands in a "one shot" Order. When one of the players set a point or makes a fault, the script execute an order (2 second of time is enough...) that manages the Attributes and the Triggers.APPLE=(GetAttribute("MyApple"))/10000;
I hope this explains...RunPlayer_Game[()
{
// aggiungere controllo game + mantieni attributi
debug(GetAttribute("Ai_Game"));
debug(GetAttribute("Player_Game"));
if(((GetEventState("Win_Player")=true)or(GetEventState("Win_Player2")=true))and(PLAYER_GAME!=2))
{
SetAttribute("Player_Game", PLAYER_GAME+1);
}
if(((GetEventState("Win_Player")=true)or(GetEventState("Win_Player2")=true))and(((PLAYER_GAME=2)and(AI_GAME=2))or((PLAYER_GAME=1)and(AI_GAME<1))))
{
SetAttribute("Player_Game", PLAYER_GAME+1);
SetEventState("Win_Player2", true);
SetEventState("Win_Player", false);
}
if(((GetEventState("Win_Ai")=true)or(GetEventState("Win_Ai2")=true))and(AI_GAME!=2))
{
SetAttribute("Ai_Game", AI_GAME+1);
}
if(((GetEventState("Win_Ai")=true)or(GetEventState("Win_Ai2")=true))and(((AI_GAME=2)and(PLAYER_GAME=2))or((AI_GAME=1)and(PLAYER_GAME<1))))
{
SetAttribute("Ai_Game", AI_GAME+1);
SetEventState("Win_Ai2", true);
SetEventState("Win_Ai", false);
}
if(self.time>TIME+2)
{
SetEventState("Adv_Player", false);
SetEventState("Adv_Ai", false);
SetAttribute("Ai_Points",0);
SetAttribute("Player_Points",0);
SetEventState("Win_Player", false);
SetEventState("Win_Ai", false);
SetEventState("AI_Pos",true);//TeleportEntity("AI", "Ai_Start");
TeleportEntity("PLAYER", "Player_Start");
self.think="RunPlayer";
return 0;
}
}
}]
Can anyone point me in the right direction or tell me where i can find these features...like a manual or tutorials for simkin, or should i just goto the simkin website? thx in advanceuse the new simkin features
this combined with your feature list that was posted earlier sounds like this will be an amazing enigne to play around with!1 - It works exactly like RF in the sense that it is a single executable that uses a world, scripts and config files to create the game.
2 - The media will be securely kept within a 'pack' file.
3 - You must create your own shaders using Rendermonkey or another FX capable shader designer tool.
4 - A single, centralized tool is used for all aspects of development.
5 - Supports 3ds, ms3d, X and it's own animation data so that you can create yor own exporters.
6 - It will be free.
7 - It will not be open source.
8 - For Windows platform only.
Awsome so your going to re-release this... er sorry it was a while ago ...did you release this? i remember see-ing screens ect for it can't remember whether this was released or notwith the commercial release of Kumajutso