ID:161573
 
One of these days I'm gonna have to put together a voting system. But with all the stuff I've done I still haven't figured out a way to put together a dynamic list of players or items that players can choose from. How is it done?
Obs wrote:
put together a dynamic list of players or items that players can choose from. How is it done?

Uhm, uh. Put a list of players together (loop threw the clients) and a list of choices and use that in input(). Am I getting you right, since this shouldn't be a problem?
In response to Kaioken
Kaioken wrote:
Obs wrote:
put together a dynamic list of players or items that players can choose from. How is it done?

Uhm, uh. Put a list of players together (loop threw the clients) and a list of choices and use that in input(). Am I getting you right, since this shouldn't be a problem?

I've never used input(). In fact this is the first time I've heard of it. Interesting.

Do variables in an input update automatically?
In response to Obs
You don't have to use "input()" to handle the actual vote, you can use an HTML-popup based system, or whatever else you want. input() is simply the most common method...

Obs wrote:
I've never used input(). In fact this is the first time I've heard of it.

Wow. Perhaps I might as well send you to the beginner tutorials and DM Guide and Reference...

Do variables in an input update automatically?

Do bears pee in the woods? Though, you should explain your question better, I can't know what's exactly on your mind by
"variables updating automatically".
In response to Kaioken
Up to this point all I've used are the new interface features of BYOND 4.0.

Now, of course these interfaces do not update automatically, and they are different for every player, which can create a problem if you want an interface that multiple people share and can interact with and have everyone see the changes being made together. I have had to program all that by hand because BYOND of course doesn't do it.

So now I ask, is input() the same way? For instance, if in this list of players in input(), a player were to suddenly change his name or whatever, is the player's name in the list going to change too for anyone who already has the input window open? Probably not. But I felt like asking anyway.



How difficult is it to do HTML based popups? I've seen them before but they are pretty ugly compared to nice interface stuff. But probably easier to use. But uglier.
Actually, is it possible to put an HTML popup inside a child of an interface window instead of making it a stand alone popup? That would be sweet.
dynamic list of players

Loop through clients connected. Add each one to a list.

or items that players can choose from

I suggest this format:
list[vote_topic] = list2params(list(answer1,answer2...))
// list2params is used to prevent tons of lists from existing at once...


That's all I can offer. You'll need to better explain what you need help with otherwise I can't get any more specific.
In response to Obs
Obs wrote:

For instance, if in this list of players in input(), a player were to suddenly change his name or whatever, is the player's name in the list going to change too for anyone who already has the input window open?

That's not really how input is supposed to work - what I mean is the pop up appears, user chooses an option, you handle the result. The pop up itself wouldn't really need to be updated as the user usually makes a decision fairly quickly.

Actually, is it possible to put an HTML popup inside a child of an interface window instead of making it a stand alone popup? That would be sweet.

Yeah, that' what the browser interface control is for.
In response to Nickr5

Actually, is it possible to put an HTML popup inside a child of an interface window instead of making it a stand alone popup? That would be sweet.

Yeah, that' what the browser interface control is for.

Where can I find more documentation or tutorials about the browser interface and HTML windows?
In response to Obs
-browse proc
-Topic proc (datum)
-ref text macro (if your read the two above you probably shouldn't need this)
-http://www.byond.com/members/DreamMakers/files/ unknownperson.2007-1121/browserinterfaces_part1.html
and for the browser control itself you can try Help > Skin Reference..., though it should be pretty self-explanatory.
In response to Obs
Obs wrote:
So now I ask, is input() the same way? For instance, if in this list of players in input(), a player were to suddenly change his name or whatever, is the player's name in the list going to change too for anyone who already has the input window open? Probably not. But I felt like asking anyway.

Yes, input() doesn't update in realtime. To be honest, there's no reason it would. The way it works, you pass quite a static /list of choices to input(), and then the caller proc waits until the player makes a choice (and therefore input() returns).
But you don't need it to update for that name-changing case anyway. input() has some flexible features in regards to the arguments used; for example, you can use an object (ie a mob) directly in it, and the object's name will appear in the list, but it will return the object reference and not it's name. Either way you shouldn't identify any object by it's name.

In addition, the input() and alert() boxes are hardcoded and since you don't handle them yourself, you cannot modify them to include more features, or update them, etc. However, there is one trick that allows you to make input() and alert() boxes that can expire automatically in a given time.

How difficult is it to do HTML based popups?

It depends if you already know HTML, too, but it isn't hard to learn. The Topic() proc may take a little time getting used to, but it is nothing particular difficult and you'll get into it after some experimenting. As with most things, the DM Reference can help a lot.

I've seen them before but they are pretty ugly compared to nice interface stuff. But probably easier to use. But uglier.

Actually they require some setting up as well similarly to interfaces, so they're not as easy to use as an input().
Also, well, usually people use HTML popups because of the opposite! They find alert() and input()s relatively ugly.
The thing is, with HTML popups, you are actually handling the 'input' in a lower-level than calling the input() proc (thankfully of course the browser does the technical/very low level stuff for you) and you can control it better; since you control the HTML page generated, you can make many kinds of forms, make it ugly or pretty, you can include any colors or images you want, etc. So in actuality, it can be much prettier than the input() and alert() boxes, and also more flexible.
But personally, I like using input() and alert(). It's convenient in the way everything is completely handled for you and you only need to implement one proc call, and it's simple to use (myself, I don't need anything too fancy).

With that said, there is the HTML popup library (and probably others of course) by Shadowdarke which will do most of the stuff for you.
http://www.byond.com/developer/Shadowdarke/sd_Alert
There is also
http://www.byond.com/developer/Shadowdarke/sd_window
Supposedly like a more advanced version IIRC.

Actually, is it possible to put an HTML popup inside a child of an interface window instead of making it a stand alone popup? That would be sweet.

I won't say I've tried, but it might be possible since some interface elements do support HTML.

Where can I find more documentation or tutorials about the browser interface and HTML windows?

In the usual places on the BYOND site. [link]