thoughts, fix error in scripting

This commit is contained in:
Jeremy Penner 2011-09-22 08:30:49 -04:00
parent a36c4bf7ce
commit a061e0f8ee
3 changed files with 14 additions and 11 deletions

View file

@ -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

View file

@ -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
====

View file

@ -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)