thoughts, fix error in scripting
This commit is contained in:
parent
a36c4bf7ce
commit
a061e0f8ee
|
@ -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:
|
debugging output:
|
||||||
- decorate classes which we expect not to be in the output, warn if we persist them
|
- decorate classes which we expect not to be in the output, warn if we persist them
|
||||||
|
|
|
@ -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
|
How to refer to things
|
||||||
|
|
||||||
====
|
====
|
||||||
|
|
13
scripting.py
13
scripting.py
|
@ -437,9 +437,6 @@ class SyntSet(SyntDesc):
|
||||||
if not isinstance(val, Fail):
|
if not isinstance(val, Fail):
|
||||||
vm.Log(vm.vars.Set(self.lvalue.syntVar, vm.Pop(), self))
|
vm.Log(vm.vars.Set(self.lvalue.syntVar, vm.Pop(), self))
|
||||||
|
|
||||||
class SyntWhen(SyntDesc):
|
|
||||||
desc = [["When"], " ", (SyntEvent, 1), ":", (SyntBlock, 2)]
|
|
||||||
|
|
||||||
class SyntEvent(SyntDesc):
|
class SyntEvent(SyntDesc):
|
||||||
rgclsSyntEvent = []
|
rgclsSyntEvent = []
|
||||||
desc = [[" "]]
|
desc = [[" "]]
|
||||||
|
@ -451,6 +448,9 @@ class SyntEvent(SyntDesc):
|
||||||
for synt in SyntExpr.RgsyntReplace(syntChild, st, rtype):
|
for synt in SyntExpr.RgsyntReplace(syntChild, st, rtype):
|
||||||
yield synt
|
yield synt
|
||||||
|
|
||||||
|
class SyntWhen(SyntDesc):
|
||||||
|
desc = [["When"], " ", (SyntEvent, 1), ":", (SyntBlock, 2)]
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
@RegStmt
|
@RegStmt
|
||||||
class SyntPrint(SyntDesc):
|
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, False)
|
||||||
pw.Draw(ascr, 1, 1, ascr.W(), 0, mpksel, True)
|
pw.Draw(ascr, 1, 1, ascr.W(), 0, mpksel, True)
|
||||||
|
|
||||||
class PselState(Token):
|
class PselState(LeaveJoinToken):
|
||||||
def InitPersistent(self, owner, block):
|
def InitPersistent(self, owner, block):
|
||||||
Token.InitPersistent(self, owner, "pselstate")
|
Token.InitPersistent(self, owner, "pselstate")
|
||||||
self.block = block
|
self.block = block
|
||||||
|
@ -941,11 +941,6 @@ class PselState(Token):
|
||||||
return self.Mpksel(pwRoot, client, self.mpclient_psel)
|
return self.Mpksel(pwRoot, client, self.mpclient_psel)
|
||||||
def PselByClient(self, client):
|
def PselByClient(self, client):
|
||||||
return self.mpclient_psel[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):
|
class GameScriptTest(Game):
|
||||||
def InitPersistent(self):
|
def InitPersistent(self):
|
||||||
|
|
Loading…
Reference in a new issue