diff --git a/marmots_todo.txt b/marmots_todo.txt index e6ff8e6..26bb934 100644 --- a/marmots_todo.txt +++ b/marmots_todo.txt @@ -1,4 +1,7 @@ -- listen to many events at once (required for vm, very useful to do away with awkward oob pattern most places) +mixins / components? having the right degrees of freedom is awkward with inheritance + - useful for: synts (typeable, syntdesc), tokens (OvStatic is just taggable) + +typeable is wrong for most synts; data should be stored in a selection. debugging output: - decorate classes which we expect not to be in the output, warn if we persist them diff --git a/script-thoughts.txt b/script-thoughts.txt index c158780..dee0bca 100644 --- a/script-thoughts.txt +++ b/script-thoughts.txt @@ -1,3 +1,8 @@ +script quotas: + - infinite loops are bad. + - we do not want "new frames" to happen constantly, so a "when this {expr} happens" event will be triggered + when the values are dirty. "when x > 0: x ++" is an infinite loop! + How to refer to things ==== diff --git a/scripting.py b/scripting.py index 003b061..fccda79 100644 --- a/scripting.py +++ b/scripting.py @@ -437,9 +437,6 @@ class SyntSet(SyntDesc): if not isinstance(val, Fail): vm.Log(vm.vars.Set(self.lvalue.syntVar, vm.Pop(), self)) -class SyntWhen(SyntDesc): - desc = [["When"], " ", (SyntEvent, 1), ":", (SyntBlock, 2)] - class SyntEvent(SyntDesc): rgclsSyntEvent = [] desc = [[" "]] @@ -451,6 +448,9 @@ class SyntEvent(SyntDesc): for synt in SyntExpr.RgsyntReplace(syntChild, st, rtype): yield synt +class SyntWhen(SyntDesc): + desc = [["When"], " ", (SyntEvent, 1), ":", (SyntBlock, 2)] + #debug @RegStmt class SyntPrint(SyntDesc): @@ -912,7 +912,7 @@ class Pov(TokenClient): pw.Draw(ascr, 1, 1, ascr.W(), 0, mpksel, False) pw.Draw(ascr, 1, 1, ascr.W(), 0, mpksel, True) -class PselState(Token): +class PselState(LeaveJoinToken): def InitPersistent(self, owner, block): Token.InitPersistent(self, owner, "pselstate") self.block = block @@ -941,12 +941,7 @@ class PselState(Token): return self.Mpksel(pwRoot, client, self.mpclient_psel) def PselByClient(self, client): return self.mpclient_psel[client] - def run(self): - print "pselstate running" - with self.game.evLeave.oob(self, self.OnLeave): - while True: - self.OnJoin(self.game.evJoin.receive(self)) - + class GameScriptTest(Game): def InitPersistent(self): Game.InitPersistent(self)