SC CODE: // Copyright 2024. Civilware. All rights reserved.
// TELA Decentralized Web Document (TELA-DOC-1)
Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "index.html")
31 STORE("descrHdr", "Index file")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "index.html")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "251792f8f03eaeece5634d69579bf819d448e28d10ad643f35a83a27819d8233")
37 STORE("fileCheckS", "4c334d9487740ee31b4cc2c9e6c54b9699661c84d2585aecfdb6914015751b9")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*<!DOCTYPE html>
<html>
<title>Last Resort</title>
<body style="margin:0; background:#222;">
<svg id="game" viewBox="0 0 0 0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet">
<defs id="defs"></defs>
<g id="bg-deep"></g>
<g id="bg-mid"></g>
<g id="bg-front"></g>
<g id="tiles"></g>
<g id="floor"></g>
<g id="platforms"></g>
<g id="players"></g>
<g id="objects"></g>
<!--<g id="debugLayer"></g>-->
</svg>
<svg id="hud" style="position:absolute; bottom:10px; left:10px;width:200px; height:50px">
<text id="hpText"
x="20"
y="40"
font-size="28"
font-family="Consolas, monospace"
text-anchor="start">
</text>
<text id="scoreText"
x="72"
y="30"
font-size="16"
font-family="Consolas, monospace"
fill="white">
</text>
<text id="timeText"
x="72"
y="40"
font-size="14"
font-family="Consolas, monospace"
fill="white">
</text>
</svg>
<svg style="position:absolute; left:0px;top:40px; width:100%; height:150px"><g id="ui" transform="translate(0,0)" ></g></svg>
<svg id="modal" style="position:absolute; bottom:0px; left:0px;width:100%; height:100%;opacity:0">
<g transform="translate(0,0)" >
<rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.7)" />
<g id="modalText"></g>
</g>
</svg>
<script src="effects.js"></script>
<script src="levelart1.js"></script>
<script src="levelart2.js"></script>
<script src="levelart3.js"></script>
<script src="levels.js"></script>
<script src="game.js"></script>
<script src="ai.js"></script>
<script src="aihelpers.js"></script>
<script src="update.js"></script>
<script src="main.js"></script>
</body>
</html>*/ |
| SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'// Copyright 2024. Civilware. All rights reserved.
// TELA Decentralized Web Document (TELA-DOC-1)
Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "index.html")
31 STORE("descrHdr", "Index file")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "index.html")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "251792f8f03eaeece5634d69579bf819d448e28d10ad643f35a83a27819d8233")
37 STORE("fileCheckS", "4c334d9487740ee31b4cc2c9e6c54b9699661c84d2585aecfdb6914015751b9")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*<!DOCTYPE html>
<html>
<title>Last Resort</title>
<body style="margin:0; background:#222;">
<svg id="game" viewBox="0 0 0 0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet">
<defs id="defs"></defs>
<g id="bg-deep"></g>
<g id="bg-mid"></g>
<g id="bg-front"></g>
<g id="tiles"></g>
<g id="floor"></g>
<g id="platforms"></g>
<g id="players"></g>
<g id="objects"></g>
<!--<g id="debugLayer"></g>-->
</svg>
<svg id="hud" style="position:absolute; bottom:10px; left:10px;width:200px; height:50px">
<text id="hpText"
x="20"
y="40"
font-size="28"
font-family="Consolas, monospace"
text-anchor="start">
</text>
<text id="scoreText"
x="72"
y="30"
font-size="16"
font-family="Consolas, monospace"
fill="white">
</text>
<text id="timeText"
x="72"
y="40"
font-size="14"
font-family="Consolas, monospace"
fill="white">
</text>
</svg>
<svg style="position:absolute; left:0px;top:40px; width:100%; height:150px"><g id="ui" transform="translate(0,0)" ></g></svg>
<svg id="modal" style="position:absolute; bottom:0px; left:0px;width:100%; height:100%;opacity:0">
<g transform="translate(0,0)" >
<rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.7)" />
<g id="modalText"></g>
</g>
</svg>
<script src="effects.js"></script>
<script src="levelart1.js"></script>
<script src="levelart2.js"></script>
<script src="levelart3.js"></script>
<script src="levels.js"></script>
<script src="game.js"></script>
<script src="ai.js"></script>
<script src="aihelpers.js"></script>
<script src="update.js"></script>
<script src="main.js"></script>
</body>
</html>*/'] |