ID:165006
 
turn_handler
proc
match(mob/a,mob/b) //could be problems here
a.movement=a.maxmovement
if(a.client) //if not NPC
var/H=input(a,"Please select a command") in list("fight","move","surrender")
switch(H)
if("fight")
var/list/L=typesof(/mob/fight/proc)
input("Select an attack") as null| anything in L
call(L) (b)
match(b,a)
else
match(b,a)
Recently, i've been working on a turn system but have come across some problems. Though this is still a how-to as I was curious how would be the best way to find what skills the player has, then give them the option of using them. Though i'm not sure how would be the best way to display to the user what skills he can use. I would prefer if I could do it with lists, as I could add and remove them at will. Thanks.


Speedro
I understand what you're saying dude, but just to keep you from confusing folks in the future:

It's a datum.

Dantom is ... Well, Dan and Tom, the reason why we have BYOND. etc. I think of it as the parent company owning BYOND, although not sure if that's accurate.

Datum is a real word meaning an item of data. A single piece of information, as fact, statistic, or code. And for BYOND specific usage, the ultimate ancestor of all other object types.

----

As for your turn handler, I don't see why you can't use lists, especially if you say that's what you want. Have you tried it? Do you not know how?

If they're only going to be used rarely, what I'd probably do is write a get_player_actions() proc that would generate and return a list on the fly based on whatever the criteria for your player actions were. But there are a bunch of other ways to do it as well.
In response to Zagreus
As for your turn handler, I don't see why you can't use lists, especially if you say that's what you want. Have you tried it? Do you not know how?


Well, there is no reason why I can't. I have tried it, and it doesn't work. That's because I don't know how I would go about making a list that when you choose something from the list, it actually calls the procedure action that list has. I don't know excactly how to explain it, but think of it this way: It's the players turn and it's time for his attack. He looks into a list of his/her available skills and selects one. Though I don't want a giant 'if(H=="bam")' etc. etc. I want the options in the list to actually be the procedure. Though if I do that, the user is going to be selecting from a typecasted list (EX: Select a move. In list /mob/attack/bam).

EDIT: Then I tried this:
turn_handler
proc
match(mob/a,mob/b) //could be problems here
a.movement=a.maxmovement
if(a.client) //if not NPC
var/H=input(a,"Please select a command") in list("fight","move","surrender")
switch(H)
if("fight")
var/list/L=typesof(a.skills)
input("Select an attack") as null| anything in L
call(L) (b)
match(b,a)
else
match(b,a)
With this as the mobs skills:
mob
skills=list(/mob/fight)
fight
proc
woo(mob/m)
world<<"woo [m]" //just a test
In response to Speedro
Anybody there? bump.