Need some simple coding help

2005-03-01 Thread mx2k
Hello @ all,

we have written a small program (code below) for our own
in-developement rpg system, which is getting values for 4
RPG-Characters and doing some calculations with it.

now we're trying hard to find out how to get it working with 'n'
Characters, so you will be asked to enter a number at the beginning,
asking you how many characters you want.

anyone out there who could help us?

also i wonder how i can read the current date/time (we don't understand
datetime() )and put it into a variable and print that variable?

[mx] and Tschabo
doing python since yesterday :)



Code follows:
# Timeline Tools for an RPG system - Written in Python 2.4
# Created by [mx] networkz @ 27.02.05 - [EMAIL PROTECTED]
# Collaboration work of mx2k & Tschabo (von Konsti)

# import math

#-
#defining functions

#header text
def showtitle():
print ''
print '   Timeline System - Alpha Version 0.8.15 '
print ''
print '*supports 4 characters *'
print '*coding [mx] networkz & Tschabo*'
print '*created 2005  *'
#print ''
print ''

#sorting
def sortfun():
charlist = [char1[1],char2[1],char3[1],char4[1]]
charlist.sort()

#dunno if correct, is spamming move[] lists but working correctly
if charlist[0] == char1[1]:
move1[0:0] = [char1[0],char1[1],char1[2]]
if charlist[0] == char2[1]:
move1[0:0] = [char2[0],char2[1],char2[2]]
if charlist[0] == char3[1]:
move1[0:0] = [char3[0],char3[1],char3[2]]
if charlist[0] == char4[1]:
move1[0:0] = [char4[0],char4[1],char4[2]]
if charlist[1] == char1[1]:
move2[0:0] = [char1[0],char1[1],char1[2]]
if charlist[1] == char2[1]:
move2[0:0] = [char2[0],char2[1],char2[2]]
if charlist[1] == char3[1]:
move2[0:0] = [char3[0],char3[1],char3[2]]
if charlist[1] == char4[1]:
move2[0:0] = [char4[0],char4[1],char4[2]]
if charlist[2] == char1[1]:
move3[0:0] = [char1[0],char1[1],char1[2]]
if charlist[2] == char2[1]:
move3[0:0] = [char2[0],char2[1],char2[2]]
if charlist[2] == char3[1]:
move3[0:0] = [char3[0],char3[1],char3[2]]
if charlist[2] == char4[1]:
move3[0:0] = [char4[0],char4[1],char4[2]]
if charlist[3] == char1[1]:
move4[0:0] = [char1[0],char1[1],char1[2]]
if charlist[3] == char2[1]:
move4[0:0] = [char2[0],char2[1],char2[2]]
if charlist[3] == char3[1]:
move4[0:0] = [char3[0],char3[1],char3[2]]
if charlist[3] == char4[1]:
move4[0:0] = [char4[0],char4[1],char4[2]]


#showing next action times
# should also be enumerated to 'n'th action
# but how to put that into string
def shownextaction():
print 'Loop Nr. ', run_nr
print ''
print '---'
print 'Next action', move1[0], 'at tick No', move1[1]
print ' 2nd action', move2[0], 'at tick No', move2[1]
print ' 3rd action', move3[0], 'at tick No', move3[1]
print ' 4th action', move4[0], 'at tick No', move4[1]
print '---'

#log to textfile
def logfile():
outnr = str('Loop Nr. ') + str(run_nr) + str('\n')
out1 = str(' Next action ') + str(move1[0])+ str(' at tick No ') +
str(move1[1]) + str('\n')
out2 = str('  2nd action ') + str(move2[0])+ str(' at tick No ') +
str(move2[1]) + str('\n')
out3 = str('  3rd action ') + str(move3[0])+ str(' at tick No ') +
str(move3[1]) + str('\n')
out4 = str('  4th action ') + str(move4[0])+ str(' at tick No ') +
str(move4[1]) + str('\n\n')
incr_ = str('Entered Number was:  ') + str(inc) + str('\n')
incre = str('Increasing Character  ') + str(move1[0]) + str('  by
Value:  ') + str(inc) + str(' + ') + str(inc_out) + str('\n\n\n')
#timecode= str

f = file('timeline.txt', 'a')
#f.write(timecode)
f.write('Actiontimes of ')
f.write(outnr)
f.write(out1)
f.write(out2)
f.write(out3)
f.write(out4)
f.write(incr_)
f.write(incre)
f.close()




#---

#defining some stuff, calling title
showtitle()
run_nr= 0
the_end = 'this is the end. exit requested by user.'
loops = int(raw_input("Number of Loops: "))

#check if we should run, then asking for input
# here it should ask for n characters, then enu

Re: Need some simple coding help

2005-03-02 Thread mx2k
indeed, we're it is our combat timeline. we enter the initiative and
reaction time, it should find out the lowest then the next, then the
'n'th etc. and shouw it on the screen like
 Next action 'Character Name1' at tick No  'Initiative1
 2nd  action 'Character Name2' at tick No  'Initiative2'
 [...]
 'n'th action 'Character Name n' at tick No  'Initiative n'

  Now you enter a value by which the initiative should be increased,
then adding reaction time to that value and then adding the result to
reaction time. Now soring again by lowest,next,'n'th, etc. and then
again showing the output, asking for another number etc.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need some simple coding help

2005-03-02 Thread mx2k
ah, and sorry for that 'unreadable' code, but that was our first try of
coding ever. we're working through the python documentaion right now -
and - thanks to the post by STeVe we at last now that we have to
construct a class for our purpose.

Thx for any help
mx2k

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need some simple coding help

2005-03-03 Thread mx2k

 thx again, this code is nearly doing as we want and we think to have
figured out how to change it to meet our requirments. also thx for the
tip using a heap...

should there be more problems i'll post again!

[mx]

-- 
http://mail.python.org/mailman/listinfo/python-list