ID:157743
 
Code:


Problem description: What would be a sample equation for a training verb for example that multiplies a character's str mod by a certain number? I also would need to know how to code a verb that gains stats over time at the same time draining energy.

Byond has a bunch of wondrous things called operators. If you push F1 while in Dream Maker you can look them all up.

The multiplication operator is * An example (this would output 4:)
[dm]usr << 2*2[/dm]

Also: for gain and loss there are the + and - operators.
In response to Mechanios
Yeah I knew the + and - operators. Hmm so I would just have to code a multiplication problem to combine the stat mods with the verb. I just don't know how to code a verb gaining stats at whatever rate the mod is over time.
In response to Mechanios
< and > not [ and ].
In response to Howey
I apologize? Anyways I don't know how to code a verb that gians a certain stat over time. Could someone provide a sample equation?
Beerizant wrote:
What would be a sample equation for a training verb for example that multiplies a character's str mod by a certain number?

mob/verb/training()
str_mod = str_mod * 3


I also would need to know how to code a verb that gains stats over time at the same time draining energy.

mob/verb/gain_stats_over_time_while_draining_energy()
while(1)
str_mod += 5
dex_mod += 5
energy -= 5
sleep(200)
In response to Loduwijk
So the sleep(200) means the recovery? Or the draining rate?
In response to Beerizant
Draining rate...

I hope you read the DM Guide/Reference.
In response to Beerizant
http://www.byond.com/ members/?command=reference&path=proc%2Fsleep

sleep() makes the function wait for the specified number of 10ths of a second
In response to Loduwijk
Yeah I read the ZBT and only skimmed the reference.
In response to Beerizant
Well now its saying that it's an invalid proc definition. Do I need to create a proc for it?
In response to Loduwijk
Instead of spoon-feeding yet another person who refuses to put much effort into learning how to program, how about you force him/her to by giving him/her concepts he/she need to read up on to accomplish the task he/she is going for. In this case, looping and operators are what he/she would want to educate him/herself on.
In response to Spunky_Girl
Spunky_Girl wrote:
Instead of spoon-feeding yet another person who refuses to put much effort into learning how to program, how about you force him/her to by giving him/her concepts he/she need to read up on to accomplish the task he/she is going for. In this case, looping and operators are what he/she would want to educate him/herself on.

Eh em... I asked for a sample equation/code. I never asked for the whole damned code. A little advice: When someone needs help, don't be so gruff when giving it.
In response to Beerizant
You said you could do math, and yet you still ask how to create a verb that does simple multiplication? As far as I'm aware, the Guide, Reference, and the Blue Book all teach you how to define verbs in various scenarios. Along with that, they teach you about loops and operators, which are all basic concepts of any programming language (only instead of verbs, it'd be methods in other languages like Java or C++) and can be used in different ways for any specific situation. You just need to use your imagination and logic skills more (assuming you have any at all).
In response to Beerizant
lodujwik already told you how.
mob/verb/gain_stats_over_time_while_draining_energy()
while(1)//this is a loop.
str_mod += 5//your str variable
dex_mod += 5//your dex variable
energy -= 5//and this is what drains energy.
sleep(200)//this is how long to wait before it loops.
thats as far as this verb goes if you need something to recover your characters, you need to make a new proc that loops.
In response to Beerizant
Maybe how-to should have some kind of regime. Like, an example of putting in effort. Stats are the basics and can be learned from the byond book, I beleive there is also a tutorial by Lummox Jr. that teaches you about making complicated stats specifically.
In response to Gamekrazzy
I understand the equation for it. I just needed to learn how to make it gain stats and drain energy which Lodujwik showed me, but it is coming up as an invalid proc definiton. I guess I need to figure out how to fix it.
In response to Beerizant
whats the problem?
In response to Gamekrazzy
<small>edit: deleted
In response to Beerizant
You copied it incorrectly.
Page: 1 2