ID:990312
 
(See the best response by Kaiochao.)
Code:mob
var/dice=0
New()
..()
dice = roll(1,6)
verb
dice()
world << "[usr] Rolls a D6 and gets a [dice]"


Problem description: so i have been searching all the documentaition i can find and ive been trying to learn and ive been searching the web for an anser, but i just cant get no luck. so i decided to ask here an hope someone will help. im new to this an find it pretty neet im tryin to make a board game to play with my friends. ill come to other obsticles as i go but my first one is this. i am trying to make a roll dice i have figured out a bit i do got the code set to set the var an display the var as text with a message but the var message is the same everytime from the first roll. i know im just laking a line to reset the var but i cant figure out that line so some help would be very nice. thank you

You're setting the dice variable only once, inside New(). You probably want to put it in the verb, so it occurs each time the verb is used.
ok kool thanks,

so like

Code:mob
var/dice=0
New()
..()
verb
dice( dice = roll(1,6),)
world << "[usr] Rolls a D6 and gets a [dice]"

that? or sumthing else
By "in the verb," I meant in the body of the function.
mob
var roll
verb
dice()
var dice = "1d6"
roll = roll(dice)
world << "[src] rolls [dice] and gets a [roll]."
ah kool thanks for clearing that up. i went back an looked in my file an was like how do i do that an then proceeded to get a error try sumthin error try sumthin loop goin on again lol. thanks again. would you mind breaking it down and explaining the format for me right qwik so i learn? thanks
mob/verb/Roll_Dice()
world << "[src] rolls a 6 sided die and lands a [rand(1,6)]"
In response to Wulff420
Best response
//  we're working inside the /mob type
mob
// giving the /mob type a variable called "roll"
var roll

// giving the /mob type a verb called "dice"
verb/dice()
// Make a variable in the verb's scope called "dice".
// check the DM Reference on what the roll() format is.
// In this example, we're rolling 1 die with 6 sides.
var dice = "1d6"

// Set the /mob's "roll" variable to
// the result of roll(dice)
// roll() is the proc and we're giving it
// dice, which is the variable defined above
// as "1d6"
roll = roll(dice)

// Send the message.
// src = the /mob that contains the verb. (src = usr, in this case)
// dice = "1d6", defined above
// roll = roll(dice), found above
world << "[src] rolls [dice] and gets a [roll]."


And, of course, if you don't actually care about remembering what roll you got or what kind of dice you rolled, the entire code can be written like this:
mob/verb/dice() world << "[src] rolls 1d6 and gets a [roll("1d6")]."

// or
mob/verb/dice() world << "[src] rolls a six-sided die and gets a [roll(6)]."
thanks^ @ Kaiochao : thanks alot man the code compiled i just gotta go an test now as i read your snippet i think i can actualy tell what you did was define two variables and use them both.

@ Tyrannicide : ha ha man that one looks so simple to get the same result i have a tendancy to over complicate things lol. actually before i decided to post an ask about the roll command in the dm programing i was almost frustrated to the point i was about to delete my entire roll section and learn the random command so thanks for that for future reference or what not. could you also break down and explain your code there so i learn aswell.

@ all : see i have been trying to learn different game programing since the 90's when game maker tools started lol. ive tried tons of rpg maker game makers and tried to learn them ive tried nwn i tried blender ive tried everything just about an never really grasped any of it. so im trying to grasp this one because i want to make a board game to play with my friends and maybey this will be a step tword c an stuff to make other games and eventualy python to make real 3d mmos lol.

i even started this project in blender but ran into trouble there and couldnt get my enviorment to model right an display how i wanted so i figured that was dumb an just too extreme and too complicated lol specialy for a simple board game lol. so then i searched the web an found this an it is really neet very cool thing they got here with byond i like that.


maybey while im here i could ask another couple questions too.

is there a way to offset the center view on my sprite so it dosent show so much of the black space below my game board map and shows more above the sprite and to the sides see this is a basic draft of my game board and ive set up my map using the spaces as floor and the picture as wall what id like is the offset to show more of the spaces and picture and less of the black area underneath the map

also qwik question if i delete the macro control and make a new one cuz i dont really want the players running around on the game board i want them to roll the dice and move the number of spaces the dice roll result is will the default macro be back in a new project i wont lose the default macro right?

theres prolly more i need to ask but i cant think of it at the moment so we can just go from here for now lol thanks for all the help everyone
In response to Wulff420
Yeah, The default Macro Always comes back no matter what. It's like a really bad stain..

Oh and I don't really know what you mean by "is there a way to offset the center view on my sprite so it dosent show so much of the black space below my game board map and shows more above the sprite and to the sides." Im guessing you mean so you have a better view.

You might want to use this:

world
view=35 //Change the view to what you want it to be.
ah ok thanks yea i already changed it so it shows 8 spaces infront back it also shows that many spaces below and above it shows 8 spaces north south east and west around the toon what i meant was:

Something like this?
well not quite but that was pretty kool thanks for the result sumthin for later prolly but i think i figured out how to word it now i was trying to figure out if there was a way to shift the default view slightly on the y axis so it shows less of the area below my map

In response to Wulff420
Wulff420 wrote:

-off topic: LOL, read the text in that again-

Doesn't that libary shift the view like you are asking for? You should be able to use that as an example of how to do it.
ah ok thanks yea now that i think of it i prolly can figure it out from there thanks alot and yea lmao i was fixing that while you replied it would seem lol

edit: a few hours later:

it would seem i cant figure it out i been staring at that code for like forever it seems an not understanding it im a bit slow sorry

i can kinda tell its the proc part of the code i think that actualy moves the camera when you move and it would appear to me that the obj code is creating the camera and the mob code is attaching the camera to the player but im having a hard time understanding more than that lol.

but seriously thanks for showing me that eventualy if i can become much much more advanced it is possible in a difficult way to shift the default view up a little tho lol thats good to know

on a more exciting note tho that code shows me there is also a possibility to get a sort of zoomed in perspective on the player tho so for an action game or rpg you could have chars with really good detail its like 2d and a half actualy lol