ID:1092021
 
Code:
        Exploring()
if(usr.Race=="Human")
if(usr.HUAreas=="")
if(usr.Area=="Bunker")
if(usr.NExplored==1)
usr<<output("You Take Your First, Cautious, Steps Out Of The Bunker, Looking Down The Ruined Street Leading From The Bunker Into The Rest Of the City, Trying To Get Your Bearings.","Game")
sleep(144)
usr<<output("After A While Of Exploring, You Decide To Head Back To The Safety Of The Bunker For Now.","Game")
usr.NExplored=0
NeedsCheck()
else
usr<<output("Leaving The Bunker Once More, You Head Out In Search Of Supplies.","Game")
sleep(72)
if(prob(35))
usr<<output("While Out Exploring, You Found Some Food!","Game")
usr.Hunger+=5
if(usr.Hunger>=100)
usr.Hunger=100
if(prob(35))
usr<<output("While Out Exploring, You Found Some Water!","Game")
usr.Thirst+=5
if(usr.Thirst>=100)
usr.Thirst=100
if(prob(10))
usr<<output("While Out Exploring, You Found Some Food And Water!","Game")
usr.Hunger+=5
usr.Thirst+=5
if(usr.Hunger>=100&&usr.Thirst>=100)
usr.Hunger=100
usr.Thirst=100
if(usr.Hunger>=100&&usr.Thirst<=100)
usr.Hunger=100
if(usr.Hunger<=100&&usr.Thirst>=100)
usr.Thirst=100
else
..()
if(prob(10))
usr<<output("While Out Exploring, You Got Hit Over The Head By Falling Debris!","Game")
usr.Health-=10
NeedsCheck()
DeathCheck()
if(prob(10))
if(usr.NNFound==0)
usr<<output("While Walking Along, You Notice A Somewhat Untouched Neighborhood, Making A Mental Note Of It So You Can Come Back Later, You Return To The Bunker.","Game")
usr.NNFound=1
usr.HUAreas+="Nearby Neighborhood"
NeedsCheck()
else
usr<<output("Not Finding Anything Worth Noticing, You Head Back To The Bunker To Rest For Your Next Trip.","Game")
NeedsCheck()


    verb
Explore()
Exploring()


Problem description:
My verb(As far as I can tell, with my noob-ness), should work, I thought, but clicking on the verb does nothing at all, doesn't give Text, doesn't Call NeedsCheck()(unless it's getting the ones that boost hunger/thirst, then I wouldn't be able to tell without text) and I want to know why.

(HUAreas is a list in the mob vars)

I can't see the problem myself :/
1) It isn't nice to post a wall of text and say "What's wrong with this?"

2) You should never use usr in a proc. Use src instead.

3) What is usr.Area? DM offers you /area. I suggest using that.

4) Did you write this yourself? Is it a reference?
Yeah, sorry for the wall, I just didn't know where in the code the problem is.

usr.Area is the variable I use to tell my processes where the player is. My game is text based, so /area would be useless if the player isn't moving/on turf, right?

And all this code is self made, no reference at all, I've asked for help a time or two, but for different code problems.
Unlike what you might be thinking, your prob conditions do not affect others. Chances are they all fail most of the time. There are also cases where more that 1 event happens.

You can make mutually exclusive events with the help of the pick proc.
var/event = pick( 35;1 , 35;2 , 10;3 , 10;4 , 10;5 )
switch(event)
if(1)
// event 1
if(2)
// event 2
if(3)
// event 3
if(4)
// event 4
if(5)
// event 5


Take note that you shouldn't use usr in procs. Please read Dream Tutor - usr Unfriendly for details on how to use it properly.

You can also make use of the switch operator for your other stuff
Exploring()
switch(Race)
if("Human")
// human stuff
if("Elf")
// elf stuff
What does the Exploring() proc belong to? Is it a global proc? If so, you will need to tell it what mob is exploring using an argument like this:

proc/Exploring(mob/M)

mob/verb/Explore()
Exploring(usr)


I also have some nit-picking to do here.

1. It is silly to say, if X is greater than or equal to Y, set it to Y. You only want to set hunger to 100 if it is greater than 100, if it's equal you can leave it alone. Obviously this doesn't change the apparent behavior, but as a programmer you should practice coding exactly what you mean to code without leaving loopholes.

2. I have never used the output() function but I'm guessing it shows the text in a pop-up window? I just want to ask, why do that? It sounds like it might be annoying, and I think most players would prefer the default chat-like output since you can scroll back through it.

3. What in the world is going on here:

if(usr.Hunger>=100&&usr.Thirst>=100)
usr.Hunger=100
usr.Thirst=100
if(usr.Hunger>=100&&usr.Thirst<=100)
usr.Hunger=100
if(usr.Hunger<=100&&usr.Thirst>=100)
usr.Thirst=100


This would allow hunger or thirst to go above 100 if the other one was above 100. I would guess you meant to do this:

if(Hunger > 100)
Hunger = 100
if(Thirst > 100)
Thirst = 100


Any code problems you see is because I'm inexperienced, I'm not at a comp I can use to work right now, but as soon as I am, I'll work on it with the advice you have given me.

1: I realized this while looking through the code a little later, but didn't have time to fix it, so ill get to it when I can.
2: output is a pop-up, and I'm using it for long lists, 'cause I'm planning to add more areas to the game, at least 5 or so. Doing text only would still need a way to choose the area to move to, probably needing a pop-up for confirmation anyway, so why not just have a pop-up to start with?
3: I can see the stupidity of my code there, but while typing it in I was thinking I needed a fix for all 3 possibilities, Hunger, Thirst, and both, but it would be easier, as you pointed out, if I check both at the same time every time, just in case.
Exploring() is under mob. mob/proc/Exploring()

I still can't get the text to show on the screen, and I'm pretty sure I'm sending it to the right panel, I've checked and can't see anything wrong(I can't see it, doesn't mean it's not there). So I'd appreciate it if someone can point out why it wouldn't work at all. I switched to the var/Event=pick() code jem put up, but that didn't help, and I know it's my fault it's not working, but I don't know what's wrong :/
Something elsewhere in your code is responsible, so I couldn't tell you without seeing it.

also what is this:

                        if(prob(10))
usr<<output("While Out Exploring, You Found Some Food And Water!","Game")
usr.Hunger+=5
usr.Thirst+=5
if(usr.Hunger>=100&&usr.Thirst>=100)
usr.Hunger=100
usr.Thirst=100
if(usr.Hunger>=100&&usr.Thirst<=100)
usr.Hunger=100
if(usr.Hunger<=100&&usr.Thirst>=100)
usr.Thirst=100
else //call the parent??
..()


..() will call the parent proc, which there isn't one unless you also have /proc/Exploring() in addition to /mob/proc/Exploring()
Thank you all for helping, I have the code working, I changed a thing or two and (while I didn't notice exactly what was wrong) I'm guessing it was misspelling or indentation, 'cause after a little re-writing and indentation correction, it works as it should.
well most of the time the compiler will give you errors if things are mis spelled or not indented right, although not always. glad you got it working at least :)
that's the thing, it wasn't giving errors, it just wasn't showing up on the screen, so it wasn't a misspelled proc or var, it was somewhere/something else that looked right and caused no errors, but didn't work in-game. anyway, once more, thanks.
In response to Magicsofa
Magicsofa wrote:
> if(Hunger > 100)
> Hunger = 100
> if(Thirst > 100)
> Thirst = 100


Hunger=min(100,Hunger)
Thirst=min(100,Thirst)


sure, why not :P