ID:156882
![]() Jul 8 2010, 1:39 pm
|
|
I am making a round based game, and I would like the list of players, as well as the "Join Game" verb to be in the same panel, but even if I make "Join Game" in say the "Game Info" category, and the players list be in the "Game Info" category, it makes two seperate categories (one being done by a basic verb thing, and the other with a statpanel proc), please tell me how this can be done. I know it's possible because it's done in Mitadake High.
|
I realized that, and then I made in an obj, but the obj will only let me change usr. vars, if I want to change one that will be throughout the whole game, a global var, it won't work. It will say "Varname undefined var".
|
Xyphon101 wrote:
if I want to change one that will be throughout the whole game, a global var, it won't work. It will say "Varname undefined var". Then you're doing something wrong |
Ok, everything seems to be in order, but I have a slight issue, which is possibly unrelated.
I have it set up to do this: Players+=1 usr.Joined=1 players.Add(usr) Players and Joined works fine, and then I have a statpanel doing this: mob Stat() statpanel(players) stat(Join_Game) Unfortunately, the players list shows nothing in the statpanel, nothing, but the Join button is still there. Little help? |
Pirion wrote:
statpanel is used to change the panel. stat is used to add an object to the panel. Unfortunately, stat(players) doesn't work either, neither does statpanel("Stats",players) Weird, if I make the var be usr.players, and I display usr.players, it works fine. Why won't it work without that? |
mob As for the having a verb, *shrugs* |
Howey wrote:
Wouldn't a for loop be handy to show the players from the players list? No. That would be horribly inefficient and would end with more or less the same results. This should be completely possible, hes just doing something(?) wrong. |
Is players defined to the mob, and the top level? did you initiate the list?
I would try changing the variable to something else to test var/list/in_players = new() Tested and verified that this works as intended. |
No, because the Players var (number of players joined, different than the list) doesn't work either. Maybe I should show you my entire code.
var/obj/Join_Game I think the problem is that on Click() it is reading it as usr, but it won't let me read it as anything else, like world. or client., except for src but that wouldnt work. |
There's really no point in having a numerical player count, and a list of the same players. You can just use Players.len on the list
|
Maybe neither of you understood, but that's not the problem. The problem is that on my Click() the var players and Players isn't reading properly at all.
No matter how I do it, stat(players) doesn't work. The only way I can get it to work is if I make it a usr. var, but obviously that won't work. It will let me define it as an src var, but it won't work properly. I'm seriously starting to doubt any of you understand the problem at all. Also, mob/statpanel() doesn't work without the Stat() proc. |
Where did you define the players list?
Also corrected this: mob/Stat() |
I think the problem is that on Click() it is reading it as usr, but it won't let me read it as anything else, like world or client, except for src but that wouldnt work. That isn't the problem. Show where you're defining Players and players. |
What is the logic behind defining the list of players (or the player count) on the mob type? Also, same question for defining your button as /mob/obj. I really don't understand that at all.
In any case. It's pretty obvious the problem here is that you are trying to access your mob's local players and Players values, when the value actually being changed on clicks is your /mob/obj/Join's. [edit] this is what your code is doing mob I think you are under the misconception that defining a variable under mob is somehow creating a global definition. It isn't. Every mob now has their own players list. In Stat(), it is printing that specific mob's data, and when you click the Join button, it is increasing the Join object's player count and such. This should either be a global variable (by the way, you don't need to prepend things with global unless there is some discrepancy between the local scope and the global scope, like two variables with the same name), or you consistently access the proper object storing your data (in this case, the Join button). Though a global value might make more sense. |
I don't know what they do in MH, but to simulate such a thing you can make objects listed in the same panel with the players, which execute verbs in their Click()