ID:165851
 
I know the last time i was here I didn't understand anything, I took forever to explain to, I'm sure you all remember me, but where else is there to turn? Anyway, my question is this: How do i make something popup that has a list to choose from, and then something different happen as a result of each?
Use switch(input()):

switch(input("Pick something from the list.") in list("Death", "Pain", "Paralysis"))
if("Death")
src.Die()
if("Pain")
src << "You feel extreme pain which leads to your death anyway"
src.Die()
if("Paralysis")
src << "You feel unable to move"
In response to DeathAwaitsU
ahh ok got it thanks :)
new problem. I used that to make a shop. how do i make a new stat panel called "inventory" and have whatever i buy added to my inventory?
In response to Adam357
http://www.byond.com/docs/guide/ resd these are covred in the DM Guide
In response to National Guardsmen
...I can't find stat panels in there.
In response to Adam357
y do you people always post online guides? dont use online guides, use the byond help files that are built into DM, they are there for a reason, and are most likely more correct then online guides, and probably easier to read and shorter, AND they have a search function! i really dont understand y all you people always post links to online guides for basic stuff
In response to Falacy
The reference is pointless if you don't understand the basics. That's like giving someone an encyclopedia of flight terms for airplanes and never telling them what an airplane is.
In response to Popisfizzy
Here is an EXAMPLE of a statpanel. NOT exactly what you want...at all.
mob/Stat() // the Mob stat proc
statpanel("People Stats") // make a statpanel
for(var/mob/M in world) // a basic for loop
if(M.client) // if the mob is a client
stat(M) // display it
stat("Health","[M.hp]")
In response to Adam357
Adam357 wrote:
...I can't find stat panels in there.

Then you haven't been looking very much, now have you? It's right there in Chapter 7, paragraph 3: "<code>Stat</code> proc".

I highly recommend that you read the guide from begin to the end of it. Don't skim, read it completely. Understand what's written there, and you shall come out as a completely new man.
In response to Falacy
Falacy wrote:
y do you people always post online guides? dont use online guides, use the byond help files that are built into DM, they are there for a reason, and are most likely more correct then online guides, and probably easier to read and shorter, AND they have a search function! i really dont understand y all you people always post links to online guides for basic stuff

The DM Guide is THE guide on the fantastic DM language. If you want to learn the DM language, you must read the guide or you shall forever fail. I've been here for about five years now, and until recently I had never even seen the DM Guide yet. When I finished reading it, I knew practically everything about the language. Where before I didn't even know how to use things like bit flags, now I recommend it to others. Read the guide. It'll help you. A lot.

Though one point is true: the DM Guide is outdated. It was written for BYOND 2.0 (we're have 3.5 now: that's at least one full integer!). There are some things that were changed, and that's where the DM Reference comes into place: to fill out the blank spots.
In response to Revojake
Revojake wrote:
Here is an EXAMPLE of a statpanel. NOT exactly what you want...at all.
mob/Stat() // the Mob stat proc
> statpanel("People Stats") // make a statpanel
> for(var/mob/M in world) // a basic for loop
> if(M.client) // if the mob is a client
> stat(M) // display it
> stat("Health","[M.hp]")


Yeah. One of the things that isn't in the DM Guide nor the reference is that you can use <code>if()</code> to check for selected statpanels: if the statpanel isn't selected, it won't execute the code in the block, saving precious CPU where it would otherwise be wasted on information invisible to the player.

mob
var
hp=50
maxhp=50
Stat()
if(usr==src)
if(statpanel("Stats"))
stat("Health","[hp/(maxhp/100)]%")
if(statpanel("Players"))
for(var/mob/M in world)if(M.client)
var/rank="Player"
switch(M.ckey)
if("dan","tom")rank="God" //BYOND Founders
if("deadron","lummoxjr","mikeh","shadowdarke")rank="Demi-God" //BYOND Developers
if("gughunter","nadrew")rank="Semi-God" //BYOND Staff
if("androiddata")rank="Devil" //BYOND Pest(TM)
if("athk")rank="Demon" //BYOND Spammers 'n Trolls Inc. ( nothing against you personally, A.T.H.K, apart from you spamming my Members' blog (twice, if you own that Peter key) )
stat("[M.name]","[rank]")
if(statpanel("Inventory")) stat(contents)
else
if(statpanel("[src]'s Inventory")) stat(contents)

client/Stat()
if(mob)mob.Stat() //always call the Stat() proc of the local mob
return ..()


This shows some of the more advanced usages of statpanels. By using <code>if(statpanel(<NAME>))</code>, you can save CPU by not calculating things like i.e. ranks of other players if you aren't viewing that statpanel.
It bases a rank upon the ckey of the mob.

It always calls the <code>Stat()</code> proc of the local mob (if available), and by setting <code>client.statobj</code> to another mob you can view their inventory.
In response to Adam357
Adam357 wrote:
...I can't find stat panels in there.

You're not meant to look for stat panels in there. It's the DM Guide, not the DM reference. You're meant to read it like a book. You might say that "This doesn't help me specifically on my problem" but that's just how programming is. Think about how you were taught maths. Your teacher would have said something like "2 + 2 = 4" "4 + 5 = 9" but the point wasn't to be able to solve 2+2 and 4+5, the point was to understand the concept of addition. So while the DM guide might not teach you how to work out 65 + 339, it will teach you 1 + 1.
In response to Android Data
Android Data wrote:
The DM Guide is THE guide on the fantastic DM language. If you want to learn the DM language, you must read the guide or you shall forever fail. I've been here for about five years now, and until recently I had never even seen the DM Guide yet. When I finished reading it, I knew practically everything about the language. Where before I didn't even know how to use things like bit flags, now I recommend it to others. Read the guide. It'll help you. A lot.

Though one point is true: the DM Guide is outdated. It was written for BYOND 2.0 (we're have 3.5 now: that's at least one full integer!). There are some things that were changed, and that's where the DM Reference comes into place: to fill out the blank spots.

ive never once looked at it and i bet i know more then you <.<
In response to Falacy
Falacy wrote:
Android Data wrote:
The DM Guide is THE guide on the fantastic DM language. If you want to learn the DM language, you must read the guide or you shall forever fail. I've been here for about five years now, and until recently I had never even seen the DM Guide yet. When I finished reading it, I knew practically everything about the language. Where before I didn't even know how to use things like bit flags, now I recommend it to others. Read the guide. It'll help you. A lot.

Though one point is true: the DM Guide is outdated. It was written for BYOND 2.0 (we're have 3.5 now: that's at least one full integer!). There are some things that were changed, and that's where the DM Reference comes into place: to fill out the blank spots.

ive never once looked at it and i bet i know more then you <.<

I know more coding then you and I am a newbie at it. And my grammar skills own yours, remember, grammar is everything on a forum.
In response to King of Slimes
God will you stop ripping on people and spamming the forums.. thats my job :( lol.

This is a developer how-to helping forum if your not gonna help don't post your really not helping anybody at all telling them that your grammer "owns"..
In response to A.T.H.K
you started a sentence with "And" aparently youre grammer isnt all to great
and no! grammer is only everything in an essay, or a paper, or a novel, it doesnt matter at all on forums, as long as what you say is understandable
In response to Falacy
Falacy wrote:
you started a sentence with "And" aparently youre grammer isnt all to great
and no! grammer is only everything in an essay, or a paper, or a novel, it doesnt matter at all on forums, as long as what you say is understandable

Actually it does matter, this isnt a chat-room.

And it's "Grammar" not whatever you said.
In response to A.T.H.K
A.T.H.K wrote:
God will you stop ripping on people and spamming the forums.. thats my job :( lol.

This is a developer how-to helping forum if your not gonna help don't post your really not helping anybody at all telling them that your grammer "owns"..

Excuse me, what is that word?
In response to Falacy
Falacy wrote:
ive never once looked at it and i bet i know more then you <.<

You're on, newbie! I've been here for about five years now. You just joined this year.

Feel free to meet me on wiz_chat if you're really serious about this, though. If I'm bored enough I just might accept!

EDIT: Same for King of Slimes.
In response to Android Data
Challenge me to a code-off on this forum XD.
Page: 1 2