ID:1801435
 
(See the best response by Lummox JR.)
Code:
mob
proc
OpenStatsTab()
if(HSO)
winshow(client,"stats",0)
else
for(var/obj/Techniques/O in contents)
winset(client,"techniques.grid1",O)
winshow(client,"techniques",1)


Problem description:
Basically, I'm trying to show the persons techniques in the interface tab, that'll pop up and I'm trying to make it look as organised as possible, can someone help me and tell me how to put Grids in there to make it look neater. ( Will be very appreciated, Thank you a lot. )
You're using winset() where you should be using output(). The winset() proc alters parameters of the control. output() sends something to the control to display. However you would need more info to output to a grid, such as the column and row.
In response to Lummox JR
So let's say the icon is there, name of the object and suffix of the object. How would I make it so it automatically puts itself in columns and grids.
Best response
The suffix won't display automatically this way (you'd need to throw it into another column). Let's say you want two columns: one with the icon and name, one with the suffix.

winset(player, "mygrid", "cells=2x[mylist.len]")
for(var/i=1, i<=mylist.len, ++i)
var/obj/item = mylist[i]
player << output(item, "mygrid:1,[i]")
player << output((item&&item.suffix), "mygrid:2,[i]")

First the grid is changed to the size it needs to be to hold all of the items. This is optional because the grid will grow as needed, but if you didn't do this at the beginning you'd want to do it at the end, to trim off any excess rows left over from the last time the grid was used.

For each object, the object itself--which includes both icon and name if you told the grid to show the names of objects--goes into column 1 of row i. The suffix goes into column 2 of that same row; I did a trick with && to make sure it will output null (clear the cell) if the object is null.
In response to Lummox JR
Thanks, i'm just trying to analyse the code and see how it works because, this is so not my area XD. Thanks for the help now, I have to just learn how to incorporate it into my system and BAM, I'll have a grid system, I can use for everything :P
In response to Lummox JR
Sorry to bother you but, I was just wondering if this was correct
mob
proc
OpenStatsTab()
if(HSO)
winshow(client,"techniques",0)
else
var/list/mylist = new/list
for(var/obj/A in contents) mylist.Add(A)
winset(client, "techniques.grid1", "cells=2x[mylist.len]")
for(var/i=1, i<=mylist.len, ++i)
var/obj/techniques = mylist[i]
client << output(techniques, "techniques.grid1:1,[i]")
client << output((techniques&&techniques.suffix), "techniques.grid1:2,[i]")
winshow(client,"techniques",1)
Well, you don't need the mylist var, since you can just use contents directly as long as you don't have any mobs in your contents. If that's a concern, though, then there's no harm in copying the list.

As far as I can tell that code looks good.
Shouldn't this:

for(var/i=1, i<=src.skills, ++i)


be this:

for(var/i=1, i<=src.skills.len, ++i)
If you could post all the relevant code, that'd be nice. That change I pointed out is necessary because you were comparing i, a number, to src.skills, a list. Now, at least, you should make it inside the loop safely.
I also noticed in your call to winset in update_skills() that you're doing the same thing as noted in my last post.

Other than that, I don't see anything outright wrong. If you could reproduce the error in DEBUG mode, that might help. Then post the error with problem line of code. Compiling with #define DEBUG somewhere, or alternatively, going into your environment's preferences, will do it. I find the latter more preferable.
Is the skills variable initialized?
If you could reproduce the error in DEBUG mode, that might help. Then post the error with problem line of code. Compiling with #define DEBUG somewhere, or alternatively, going into your environment's preferences, will do it.

Do the above for me and post the output + the problem code. There's something missing and I don't think it's available here (or it's evading us pretty well).
Neonkyojin wrote:
I did that nothing changed.

Well where's the output then?
That doesn't look like DEBUG mode.

Did your compile message look like this? If not, DEBUG mode was not enabled.

Do me a favor and show me your Login() stuff.
Try testing what values i reach by adding a debug message before the problem line you pointed out. If there's any issue what that line, you'll see it when the loop runs.
So have you fixed your problem now then?
Ah ok, in that case i was going to suggest that from what i could see it was likely to do with a possible conflict between the two skills vars i saw defined in your code, one as a list under the mob path, the other under gui, which is perhaps what is being referred to in code?
Oh wait, nvm.. reading through again i see that your code might be setup fine actually.. though i can't see the all the relevant bits but yeah, nvm.

Actually, mind posting your skills code? (This is only of course if you wanna still work out whats going wrong)
Yeah, you did, but.. ah well nevermind i guess.