31 procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean); |
31 procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean); |
32 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); |
32 procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); |
33 procedure StopMessages(Message: Longword); |
33 procedure StopMessages(Message: Longword); |
34 |
34 |
35 implementation |
35 implementation |
36 uses Types, uConsts, uVariables, uConsole, uUtils, uDebug, uScript; |
36 uses Types, uConsts, uVariables, uConsole, uUtils, uDebug; |
37 |
37 |
38 type PVariable = ^TVariable; |
38 type PVariable = ^TVariable; |
39 TVariable = record |
39 TVariable = record |
40 Next: PVariable; |
40 Next: PVariable; |
41 Name: string[15]; |
41 Name: string[15]; |
83 while t <> nil do |
83 while t <> nil do |
84 begin |
84 begin |
85 if t^.Name = CmdStr then |
85 if t^.Name = CmdStr then |
86 begin |
86 begin |
87 if TrustedSource or t^.Trusted then |
87 if TrustedSource or t^.Trusted then |
88 begin |
|
89 if (c <> '$') or (s[0] <> #0) then s:= ParseCommandOverride(CmdStr, s); |
|
90 case t^.VType of |
88 case t^.VType of |
91 vtCommand: if c='/' then |
89 vtCommand: if c='/' then |
92 begin |
90 begin |
93 TCommandHandler(t^.Handler)(s); |
91 TCommandHandler(t^.Handler)(s); |
94 end; |
92 end; |
95 vtLongInt: if c='$' then |
93 vtLongInt: if c='$' then |
96 if s[0]=#0 then |
94 if s[0]=#0 then |
97 begin |
95 begin |
98 str(PLongInt(t^.Handler)^, s); |
96 str(PLongInt(t^.Handler)^, s); |
99 i:= inttostr(PLongInt(t^.Handler)^); |
97 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
100 o:= ParseCommandOverride(CmdStr, i); |
98 end else val(s, PLongInt(t^.Handler)^); |
101 if i <> o then val(o, PLongInt(t^.Handler)^) |
|
102 else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
|
103 end |
|
104 else val(s, PLongInt(t^.Handler)^); |
|
105 vthwFloat: if c='$' then |
99 vthwFloat: if c='$' then |
106 if s[0]=#0 then |
100 if s[0]=#0 then |
107 begin |
101 begin |
108 //str(PhwFloat(t^.Handler)^:4:6, s); |
102 //str(PhwFloat(t^.Handler)^:4:6, s); |
109 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
103 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
110 end else; //val(s, PhwFloat(t^.Handler)^, i); |
104 end else; //val(s, PhwFloat(t^.Handler)^, i); |
111 vtBoolean: if c='$' then |
105 vtBoolean: if c='$' then |
112 if s[0]=#0 then |
106 if s[0]=#0 then |
113 begin |
107 begin |
114 str(ord(boolean(t^.Handler^)), s); |
108 str(ord(boolean(t^.Handler^)), s); |
115 if boolean(t^.Handler^) then i:= '1' |
109 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
116 else i:= '0'; |
110 end else |
117 o:= ParseCommandOverride(CmdStr, i); |
|
118 if i <> o then |
|
119 begin |
|
120 val(o, ii); |
|
121 boolean(t^.Handler^):= not (ii = 0) |
|
122 end |
|
123 else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
|
124 end |
|
125 else |
|
126 begin |
111 begin |
127 val(s, ii); |
112 val(s, ii); |
128 boolean(t^.Handler^):= not (ii = 0) |
113 boolean(t^.Handler^):= not (ii = 0) |
129 end; |
114 end; |
130 end; |
|
131 end; |
115 end; |
132 exit |
116 exit |
133 end else t:= t^.Next |
117 end else t:= t^.Next |
134 end; |
118 end; |
135 case c of |
119 case c of |