quick easy matchup thing..

BlitzMax Forums/BlitzMax Beginners Area/quick easy matchup thing..

Yahfree(Posted 2007) [#1]
I'm trying to write something simple to match up people with others..

heres my code, and i'm already having problems
SeedRnd MilliSecs()

Global ParticipantList:TList = CreateList()
Type TParticipant
	Field number%
	Field ID$
	Field match_up%
	Field is_fight%
End Type

number_of_cons$ = Input("Enter number of particpants: ")

number_of_consI% = number_of_cons$

For i=1 To number_of_cons$
	part01:TParticipant = New TParticipant
	ListAddLast(ParticipantList,part01)
	id$ = Input("ID of participant #"+i+": ")
	part01.is_fight = 0
	part01.ID = id
	part01.number = i
	part01.match_up = Rand(1,number_of_cons)
Next

For all:TParticipant = EachIn ParticipantList
Print all.ID
Next

WaitKey()


*How do you correctly translate a string into a int? you could do this in B3D
*How do i get the standard IO stream to work properly...


the goal right now is to enter a number of participants, then assign them names, then it displays the names.. Simple.. but being new to this side of Bmax is making it tough..

any help welcome...


Amon(Posted 2007) [#2]
SuperStrict

SeedRnd MilliSecs() 

Global ParticipantList:TList = CreateList()
Type TParticipant
	Field number%
	Field ID$
	Field match_up%
	Field is_fight%
End Type

Global number_of_cons:String = Input("Enter number of particpants: ") 

Global number_of_consI:Int = Int(number_of_cons:String) 

For Local i:Int = 1 To number_of_consI
	Local part01:TParticipant = New TParticipant
	ListAddLast(ParticipantList,part01)
	Local id:String = Input("ID of participant #" + i + ": ") 
	part01.is_fight = 0
	part01.ID = id
	part01.number = i
	part01.match_up = Rand(1, number_of_consI) 
Next

For local all:TParticipant = EachIn ParticipantList
Print all.ID
Next

WaitKey()


*FIXED* - Now works. :)


Yahfree(Posted 2007) [#3]
i see


Amon(Posted 2007) [#4]
I just fixed it properly and it's working. View my reviewed code.