SRL Archive - OSR Help

Multi-player on a form


P1ng

2012-09-13 21:13:08

I want to know how to create a form where the player can input as many different usernames and passwords as they like and then I can convert that into my declareplayers procedure.

I have a rough idea of how to go about this I'm just not completely sure…

NKN

2012-09-13 21:14:37

Multiple text fields, assigning each text field to an array of player info?

PlayerList[0] := TextField1.text
PlayerList[1] := TextField2.text

Something like that?

Nebula

2012-09-13 21:16:09

Check out the MSI form, see how that one's done.

P1ng

2012-09-13 21:26:26

MSI appears to use WriteINI and ReadINI to save and load the player information from it's settings document. There has to be a simpler way to do this because I do not think this script warrants having it's own setting document.

I'll have a tamper with NKN's suggesting, it seems to be somewhat down the road I had in my mind already

mormonman

2012-09-13 21:48:51

http://code.google.com/p/scarprojects/source/browse/#svn%2Ftrunk%2Fminotaur%20form

There is an ancient form of mine implementing multi-player. I cbf'ed to explain it.

P1ng

2012-09-13 21:50:14

Cool, thanks Mormonman! :) I'll have a read through the code and figure it out.

Runaway

2012-09-13 21:55:43

You can use HowManyPlayers/NumberOfPlayers and store the form values directly into the players values. Switching between list items you just show the values stored in the corresponding players array. Adding a player you Inc(HowManyPlayers), etc.

P1ng

2012-09-13 22:00:37

This is roughly how I was going to enter the info -
  
for i := 0 to (HowManyPlayers - 1) do
begin
with Players[i] do
begin
Name := FormUser[i].text;
Pass := FormPass[i].text;
Active := ActiveCheck[i].Checked;
end;
end;

mormonman

2012-09-13 22:53:11

I consider saving form settings a pretty important part of the form…you shouldn't leave it out, and trying to add it afterwards can get ugly.