Skip to content

Instantly share code, notes, and snippets.

@Gwith
Gwith / api.js
Created December 27, 2017 17:57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie-edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<style>
#map{
height: 400px;
from dialogue_menus import *
from rooms import *
courtyard = Room(
'This is a courtyard',
{'North':'Entrance'},
['item1', 'item2'],
['monster1', 'monster2']
)
from dialogue_menus import *
from rooms import *
courtyard = Room(
'This is a courtyard',
{'North':'Entrance'},
['item1', 'item2'],
['monster1', 'monster2']
)
import json
with open('roomsjson.txt', encoding='utf-8') as data_file:
data = json.loads(data_file.read())
class Room:
def __init__(self, description, directions, items, monsters):
self.description = description
self.directions = directions
self.items = items
import sys, logging
class Room:
def __init__(self, description, directions, items, monsters):
self.description = description
self.directions = directions
self.items = items
self.monsters = monsters
def __repr__(self):
class Rooms:
def __init__(self, description, directions, items, monsters):
self.description = description
self.directions = directions
self.items = items
self.monsters = monsters
def interact(self):
for k, v in enumerate(self.directions.keys(), 1):
print(k, v)
def test(self):
try:
for row in range(self.orders_table.rowCount()):
for col in range(self.orders_table.columnCount()):
value = self.orders_table.item(row, col).text()
self.orders_table_list.append(value)
except Exception as e:
print(e)
Message in console: 'NoneType' object has no attribute 'text'
def test(self):
a_list = []
for row in range(self.orders_table.rowCount()):
for col in range(self.orders_table.columnCount()):
if self.orders_table.item(row, col) == None:
value = '0'
else:
value = self.orders_table.item(row, col).text()
a_list.append(value)
print(a_list)
def test(self):
for row in range(self.orders_table.rowCount()):
for col in range(self.orders_table.columnCount()):
value = self.orders_table.item(row, col)
value = str(value.text())
self.orders_table_list.append(value)
print(self.orders_table_list)
from monster_classes import Goblin, Troll
class Room:
def __init__(self, name, directions, items, monster, description=None):
self.name = name
self.directions = directions
self.items = items
self.monsters = monster
self.description = description