ID:159382
 
Well first of all, is this even possible?

Secondly, if it is, how would you go about doing it? I would imagine it would come with several conditions and would have to be limited... The idea I came up with is more as follows...

The user could create a new verb with several specifications. For example, they choose if it is a message verb, an action verb, etc. This ideally however would have to go through... at least in early testing, several input commands.

Now, while I know this much is possible, I guess the real question I'm actually trying to ask is the possibility of programming in game. This was a poorly structured message, but it includes both my idea and what I'm looking for.

Thanks for your time.

-- Joh!
Not possible. It's also been brought up before, use Forum Search next time.
Something like this could be semi-simulated using objects and datums.
This is basically how the pet AI system works in BE; except instead of it running automatically, the players would have to click on an object.
Well, the most you can do is combine proper presentation with customizable datums and command handling.

First of all, presentation. You can't use info controls; they display a verb's complete name, and we aren't even going to be using verbs! Second of all, because of this, you need buttons, macros, or a traditional on screen HUD skill list. You can go about doing this by yourself.

Second of all, customizable datums and command handling. This can be tricky for novices, but there are tutorials on datums and client/Command() (the proc we are going to be using in our command handling) is properly documented in the reference.

attack
attack
name
mob/owner
//an example attack setup, you can go much more in depth than this

proc/Action()
for(var/mob/M in get_step(owner,owner.dir))
owner.hurt(M,attack) //have the owner hurt M for attack damage (not included :P)

New(own,atk,nam)
if(!own || !atk || !name) del(src)
owner = own
attack = atk
name = name

mob/list/attacks = new
mob/verb/New_attack()
if(!client) return
var
atk = input(src,"Attack?") as num
name = input(src,"Name?") as text
attacks[nam] = new attack (src,atk,nam)
//the above is just a short hand example, you want to check to make sure the info is valid etc
//note how we associate the attack name with the attack datum in the list
client.Set_Attack(nam)

client/Set_Attack(t)
winset(src,"Button","command='ATTACK[t]'") //set out button's command to ATTACK[attack name]
//this is merely an example (a poor one at that), all you need to do is give your player
//a means to execute the command, whether it be with an input, button, HUD, etc.

client/Command(t)
if(findText(t,"ATTACK",1,7)) //if it finds the string "ATTACK" in the beginning of the command
mob.execute_attack(copytext(t,7)) //execute the name of the attack from the 7th letter of the string on

mob/proc/execute_attack(t)
if(t in attacks)
var/attack/A = attacks[t]
A.Action()


There you have it, a nice, flexible attack system. It's not an actual verb, it's a command, and it requires a little extra work on your part, but it is worth it in the long run in some games.

EDIT: You could also use a single verbs to execute attacks using arguments. To pass an argument from a skin control, the format for the command is "[Verb] [arg]" (without the quotes, you might be able to add more than one arg, as well, unless you use as command_text in the arg declaration).
In response to Jeff8500
Yes, you can pass multiple args ^-^ I've done so multiple times. :D
In response to Spunky_Girl
Ah, OK, I pass them as command text, personally.
In response to Spunky_Girl
Spunky_Girl wrote:
Yes, you can pass multiple args ^-^ I've done so multiple times. :D

From an interface control?
In response to Falacy
Yes
In response to Spunky_Girl
Spunky_Girl wrote:
Yes

How?...
In response to Falacy
mob/verb/Verby(n as num,t as text) //or any combination you'd like :)
src<<n
src<<t

//then in the button's command box put...
Verby 1 "hello"


Whether or not it's limited to two argument passes only, I'm not sure. I believe Kaioken knows the answer to that, since he's the one who introduced me to argument passing through interface controls :D
In response to Spunky_Girl
So I see, could have sworn that didn't work last time I tried it. Oh well, good to know.
In response to Falacy
Works wonders for me :) Saves a lot of time.
In response to Spunky_Girl
It mostly works just like pretty much every other method of DS sending commands (ex commands entered in an input control), so you can of course do whatever you want; no reason for it to be limited to an X number of args. The "catch" is that they have to match the argument definitions in the verb, but that's normal. Additionally you may be implicitly pass null to args that accept it, essentially skipping them.
In response to Kaioken
So you can do...
Verby null "hello"

And it'll still work? I was thinking of testing that, but it's my bed time x.x
In response to Spunky_Girl
If the first argument in the verb is configured to accept null value, then yes. You could also use Verby "hello" for an identical effect.
EDIT: Well, except, commands aren't DM, so actually "null" doesn't mean anything and is an unknown symbol. :P
In response to Kaioken
Kaioken wrote:
EDIT: Well, except, commands aren't DM, so actually "null" doesn't mean anything and is an unknown symbol. :P

So...
mob/verb/Verby(n as null|num)
src<<n

//////////////////////

Verby null //<---- command

...would not work? If not, then how would you pass null as an argument?
In response to Spunky_Girl
You simply don't pass anything (as I've already implied). :P
In response to Kaioken
Then how would you pass an argument into the second... slot o.O
mob/verb/Verby(n as null|num, t as null|text)
if(n) src<<n
if(t) src<<t

//What if, for this particular case, don't want to use the first argument, but you do want to use the second?

Verby /*what goes here?*/ "hello"
In response to Spunky_Girl
It's the same as input for example.

input(Usr=usr,Message,Title,Default) where the only required entry is the Message.

input("Hello","Title")skips Usr because a text string is not a mob.

So, in your example because a text string is not a number you can simply put:

verby "Hello"

At least, I believe that is the logic behind it, and it should work out fine.
In response to Spunky_Girl
This is getting pretty tiresome; surely you're able to simply test it yourself instead of asking about every tidbit you can think of? I've already answered that to pass null you just skip the argument, so you don't put any value for it.
Page: 1 2