ID:165582
 

Problem description:

I'm trying to make it so say theres a bush, when you walk up to it you can click a button saying "Cut" or something liek that, and when you click it is it possable to flick the icon of the bush to say leavs flying down to the ground then its completely changed to a pic with the roots of the bush, also it being able to drop random items.
Please can anybody help me?!?! i need this!
In response to Ichi
Look up flick()
In response to Flame Sage
i have and ive tried puting it into use but it only tells you how to flick the icon of the usr not the bush
In response to Ichi
... um, try defining where the bush is? Afterall, how can you cut the bush if you can not define it? Than flick using the bush as the source (object)... usr is just an example there...

- GhostAnime
In response to GhostAnime
I've tried this:
obj
bush
icon = 'bush.dmi'
verb
Cut()
set src in oview(2)
flick('bush.dmi',obj)
flick("cuting",obj)


And then i get an error saying
grass.dm:7:error:obj:undefined var
grass.dm:8:error:obj:undefined var


Also i dont know how to make it so after its been flicked it changes icon permenatly. If somecould write it out how to do it? id be very thankfull.
In response to Ichi
Seriously, go read the DM Guide, go and do NOT skim through... I never said anything about 'obj', just 'object'... look it up in the dictionary if you don't get it yet.

Hint: src = source; usr = last player that did something (I think that's what it is)

And why are you flicking the icon file which it already is? At the sametime when the tree is cut? :/

- GhostAnime
In response to GhostAnime
obj
bush
icon = 'bush.dmi'
verb
Cut()
set src in oview(2)
flick('bush.dmi',O)
flick("cuting",O)


- Miran94
In response to Miran94
That is wrong, 'O' is not dfefined and the answer is in my post.

- GhostAnime
In response to GhostAnime
Im looking through the DM guide and i can only find were its told me how to jst flick it, and all its says is
flick('blink.dmi',usr) //show another icon
flick("fight",usr) //show usr's fight state


And ive tried using that and it dosent work.
In response to Ichi
Why don't you actually read the whole thing instead of looking at the EXAMPLES (definition: trying to convey the message to you by using of it).

In place of 'usr', make it refer to the bush... if you can't figure out how to do that, read the DM Guide -_-

The important line about that entry in reference:
Format:
flick(Icon,Object)
Args:
Icon: An icon file or state name.
Object: The target object.


To become a great programmer, you must remember about the little things; for even the slightest of problems can make the gravest of situations. Your answer is so simple that I am assuming you did not read into the DM Guide and instead just look at "examples" and trying to format them into your use; even though it may eventually cause your game to collaspe in the end.

- GhostAnime
In response to GhostAnime
GhostAnime wrote:
Why don't you actually read the whole thing instead of looking at the EXAMPLES (definition: trying to convey the message to you by using of it).

In place of 'usr', make it refer to the bush... if you can't figure out how to do that, read the DM Guide -_-

The important line about that entry in reference:
Format:
flick(Icon,Object)
Args:
Icon: An icon file or state name.
Object: The target object.


To become a great programmer, you must remember about the little things; for even the slightest of problems can make the gravest of situations. Your answer is so simple that I am assuming you did not read into the DM Guide and instead just look at examples and trying to format them into your use; even though it may eventually cause your game to collaspe in the end.

- GhostAnime

Seconded, damn listen to the guy.
In addition, from what I gathered from your first post, you DO NOT want 2 flick()'s. You want something like this instead:
    flick("leaves_falling_state",Target)
Target.icon_state = "tree_roots_state" //tree "cutted" state
//create reward objs code here...example below
var/obj/item/wood/W = new(Target.loc)
W.amount = 100 //amount var. like with money bags, how much wood there is
new /obj/item/apple(Target.loc) //you don't need to access anything with this obj here, so you don't even assign a var to it

obj/item
verb
Get()
set src in oview() //src is in view but not in usr inventory/contents
src.Move(usr) //attempt to move to contents
Drop()
set src in usr
src.Move(usr.loc) //attempt to move to usr's current turf
fruit
icon = 'fruits.dmi'
verb/Eat()
set src in usr //only run if the src is in the player clicking the verb (in inventory/contents)
usr.HP += 10
usr << "Mm, yum! You eat [src]."
del src
apple
icon_state = "apple"
orange
icon_state = "orange"

wood
icon = 'stuff.dmi'
icon_state = "logs"
var/amount = 20 //default amount.
//etc

Of course, for this code to work, replace 'Target' with the right var. I'm not telling you that, though I will point you to aread on the subject:
-DM reference (press F1 in DreamMaker). Look up 'usr (proc)' and read that. Afterwards, look up 'src (proc)'.

---EDIT---
I took the liberty to add some sample 'item system' verbs to the code example. =) Also, changed added "apple" instead of using plain "fruit". :P
In response to Kaioken
.< I'm trying my best to understand it, and im not just looking at the examples, i am reading it but as i said i find it difficult to understand ive tried replacing "obj" with object then i get the error of undifined var i've tried replacing with "Target" samething anything i put there it says that its an undifined var
In response to Ichi
... Okay, I'll be nice and tell you the answer.. if you do not understand why, you'll probably forgo programming >_> Which may not be a bad thing :[ : You want src


READ AND LEARN AS TO WHY
------------------------

The variable 'src' is a variable that REFERS to the SOURCE (s__rc_) of the verb/procedure.

Usr, as stated in the link, is a mob variable (var/mob/usr) containing the mob of the player who executed the current verb, or whose action ultimately called the current proc.

Reason why usr didn't worked is because that was refering to the last PLAYER who called something, which was YOU. Src in this case is the bush as the bush has the verb, thus the Bush is the SRC in that verb (heh, repitition should help you remember).

And you can have other targets there as well if you make variables referring to an object.
mob/M = locate(/mob) in get_step(src,dir)
This looks for a mob (variable target is M) one step ahead
if(!M)return
If M does not exist, stop the rest of the code block from happening.. unless you love errors and runtimes
flick("apple",M)
Again, M is referring to the mob one step ahead of us (hence it's the TARGET) and flicks the icon_state apple.

- GhostAnime
In response to GhostAnime
Ok i give up! i guess ill take your advice and quit! i still dont understand damit, ive tried using "src" instead and its worked (as in stopped it from saying invalid proc) and when i walk up to the bush click cut nothing happens, ive tried everything, sorry for being such a noob but ive just started and ive tried all the examples youve given me ive been trying it all day no luck.
In response to Ichi
That's why I kept stating to READ the DM Guide; if you can not take your time to learn how to program properly (although the Guide IS outdated), than you'll keep running in blindly. As a side note, I never adviced you to quit, prove it to me if I did say so :P

If you still do wish to continue programming, my advice is: learn first than attempt. That's why sometimes we also state to start small scale projects and work up.

To learn how to program in DM:
http://www.byond.com/docs/guide/
http://zilal.byond.com/tutorials/zbt.html
http://bwicki.byond.com/ByondBwicki.dmb?MiniTutorials
http://bwicki.byond.com/ ByondBwicki.dmb?FrequentlyAskedQuestions

- GhostAnime
In response to GhostAnime
Well i know basic stuff like how to teleport how to play music make maps use "Say" verb and basic things like that, but when it comes to this, i just cannot do it! im read the DM Guide as we speak and im trying to read it all and i still carnt get this damn thing to work. (is there an updated DM Guide?)
In response to Ichi
Unfortunately no. Now that I just ate lunch, I am less grumpy. If you could post an updated copy of your snippet in which you're having trouble with, we can help try to find the cause.

- GhostAnime
In response to GhostAnime
Dont forget checking out my above post on further help. :P
[link]
In response to GhostAnime
Thanks for having patiance with me lol ok so what ive got is
mob
bush
icon = 'bush.dmi'
verb
Cut()
set src in oview(2)
flick(icon,src)
flick("cuting",src)

And when i walk up to it and click cut nothing happens (brb dinner)
Page: 1 2 3