Add infos into target window
[ryzomcore.git] / ryzom / server / src / general_utilities_service / ss_notes.txt
blob954f9e144af812ed879c0e527115b66f53d9cea9
1 Module name:            Shard Script
2 Short name:                     SSS
3 Associated modules:     None
4 Requires:                       Naming Service
6 Description
7 -----------
9 Todo
10 ----
13 ****************************************************************************************************
14 * The following block is a possible better implementation of the core of the script system
15 ****************************************************************************************************
18 #if 0
19 //-------------------------------------------------------------------------------------------------
20 // class IScriptLine
21 //-------------------------------------------------------------------------------------------------
23 class IScriptLine: public NLMISC::CRefCount
25 public:
26         virtual ~IScriptLine() {}
27         virtual void execute()=0;
29 typedef NLMISC::CSmartPtr<IScriptLine> TScriptLinePtr;
32 //-------------------------------------------------------------------------------------------------
33 // class CScriptLineCmd
34 //-------------------------------------------------------------------------------------------------
36 class CScriptLineCmd: public IScriptLine
38 private:
39         CScriptLineCmd(uint32 delay,const NLMISC::CSString& service,const NLMISC::CSString& cmdLine);
40 public:
41         static CScriptLineCmd* buildNew(const NLMISC::CSString& txt);
42         virtual void execute();
43 private:
44         uint32 _Delay;
45         NLMISC::CSString _Service;
46         NLMISC::CSString _CmdLine;
49 CScriptLineCmd::CScriptLineCmd(uint32 delay,const NLMISC::CSString& service,const NLMISC::CSString& cmdLine)
51         _Delay= delay;
52         _Service= service;
53         _CmdLine= cmdLine;
56 CScriptLineCmd* CScriptLineCmd::buildNew(const NLMISC::CSString& txt)
58         todo(" convert command line to components");
59         return new CScriptLineCmd(0,txt,txt);
62 void CScriptLineCmd::execute()
64         CCommandExecutor::getInstance()->addCommand(_Delay,_Service,_CmdLine);
68 //-------------------------------------------------------------------------------------------------
69 // class CScriptLineSetVar
70 //-------------------------------------------------------------------------------------------------
72 class CScriptLineSetVar: public IScriptLine
74 private:
75         CScriptLineSetVar(const NLMISC::CSString& keyVarName,const NLMISC::CSString& keyValue,const NLMISC::CSString& targetVarName);
76 public:
77         static CScriptLineSetVar* buildNew(const NLMISC::CSString& txt);
78         virtual void execute();
79 private:
80         NLMISC::CSString _KeyVarName;
81         NLMISC::CSString _KeyValue;
82         NLMISC::CSString _TargetVarName;
85 CScriptLineSetVar::CScriptLineSetVar(const NLMISC::CSString& keyVarName,const NLMISC::CSString& keyValue,const NLMISC::CSString& targetVarName)
87         _KeyVarName= keyVarName;
88         _KeyValue= keyValue;
89         _TargetVarName= targetVarName;
92 CScriptLineSetVar* CScriptLineSetVar::buildNew(const NLMISC::CSString& txt)
94         todo("split up the call into its components");
95         return new CScriptLineSetVar(txt,txt,txt);
98 void CScriptLineSetVar::execute()
100         todo("...todo...");
104 //-------------------------------------------------------------------------------------------------
105 // class CScriptLineCall
106 //-------------------------------------------------------------------------------------------------
108 class CScriptLineCall: public IScriptLine
110 private:
111         CScriptLineCall(const NLMISC::CSString& scriptName);
112 public:
113         static CScriptLineCall* buildNew(const NLMISC::CSString& txt);
114         virtual void execute();
115 private:
116         NLMISC::CSString _ScriptName;
119 CScriptLineCall::CScriptLineCall(const NLMISC::CSString& scriptName)
121         _ScriptName= scriptName;
124 CScriptLineCall* CScriptLineCall::buildNew(const NLMISC::CSString& txt)
126         if (txt.countWords()!=1)
127         {
128                 nlwarning("the following is not a valid routine name: %s",txt.c_str());
129                 return NULL;
130         }
131         return new CScriptLineCall(txt);
134 void CScriptLineCall::execute()
136         CScriptManager::getInstance()->runScript(_ScriptName);
140 //-------------------------------------------------------------------------------------------------
141 // IScriptLine factory: buildScriptLine()
142 //-------------------------------------------------------------------------------------------------
144 static TScriptLinePtr buildScriptLine(const NLMISC::CSString& txt)
146         NLMISC::CSString keyword= txt.firstWordConst().strip();
147         NLMISC::CSString rawArgs= txt.tailFromFirstWord().strip();
149         if (keyword=="cmd")             return CScriptLineCmd::buildNew(rawArgs);
150         if (keyword=="setVar")  return CScriptLineSetVar::buildNew(rawArgs);
151         if (keyword=="runScript")       return CScriptLineCall::buildNew(rawArgs);
153         return NULL;
155 #endif