pulled some code by cracker which makes output even more awesome :P

This commit is contained in:
Lieuwe
2011-03-03 19:38:06 +01:00
6 changed files with 369 additions and 125 deletions

View File

@@ -4,7 +4,20 @@ import time
# example script
def noise(typ,amount=50):
for xx in range(284,316):
for yy in range(184,216):
for xx in range(4,612):
for yy in range(4,384):
if(random.randrange(0,100)<amount):
tpt.create(xx,yy,typ)
tpt.create(xx,yy,typ)
def increment(amount=1):
for xx in range(4,612):
for yy in range(4,384):
i = tpt.get_pmap(xx,yy)>>8
t = tpt.get_prop(i,"type")+amount
if t>=148:
t=t-148
if t==128:
t=129
if t==55:
t=56
tpt.set_type(i=i,settoint=t)

View File

@@ -1,4 +1,5 @@
import tpt
from tpt import *
import sys
import code
import ctypes
@@ -8,10 +9,11 @@ print "console module loaded."
#redirect stdout like this:
class logger:
def write(self,txt):
txt=txt.split("\n")[-1][:254]
txt=txt.strip().split("\n")[-1]
repr(txt)
tpt.log(txt)
#sys.stdout=logger()
#sys.stderr=logger()
sys.stdout=logger()
sys.stderr=logger()
element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
"nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
@@ -95,12 +97,9 @@ def handle(txt):
def _handle(txt):
#print "handling '%s'"%txt
try:
sys.stdout.write(repr(eval(tmp,handle.glob)))
sys.stdout.write(repr(eval(txt,handle.glob)))
except:
try:
exec txt in handle.glob
except Exception as ex:
error(ex)