var
list/rooms = new
room
var
name
desc
id
New(n)
name = n
rooms += src
id = rooms.len
Problem description:
Well, I'm trying to figure out a way to edit the name in-game by using the id number, or something similar. Could someone help me.
ID:141716
Dec 3 2008, 7:00 am
|
|
Code:
var Problem description: Well, I'm trying to figure out a way to edit the name in-game by using the id number, or something similar. Could someone help me. |
Dec 3 2008, 7:47 am
|
|
A room manager might be the way to go.
|
In response to Xooxer
|
|
Edit*
rooms["name"] = "Untitled" What I'm trying to say is, when you create the new room, and set a id and name for it. I wanna be able to go back and edit the name, under that id. So in the example both ID #3 and ID #4 have the name "Untitled". Now if I wanted to edit ID# 3's name and change it from Untitled to Basic Inn, and then edit ID# 4's name and change it from Untitled to Outside. How would I beable to find the IDs and change the names. |
In response to Lundex
|
|
GetRoomByID() returns a /room datum. Just set the name of the room you get from GetRoomByID().
var/RoomManager/RoomMan // the global room manager You could also just add the room editing proc as part of the room manager's functions, or even better, as a function of the room datum itself which you can call from the room manager: var/RoomManager/RoomMan |
In response to Lundex
|
|
rooms is a list containing actual rooms. It doesn't directly contain the variables of each room, and DM isn't able to read your mind currently to know which room you are referring to when you do.
|
In response to Xooxer
|
|
You don't actually need to initialize all of your object variables on New() procs, DM supports initializing them on the variable declaration itself to make it easier.
|
In response to Kaioken
|
|
Need? No. Desire? Yes.
You can't control the order of creation, or pass values returned from other objects created if you let DM control the startup. Plus, you can defer creation of objects you won't need right away, so the world loads quicker for the host, if that's an issue. I've learned from people much wiser than myself that initiating variables in the declaration is generally a noobish thing to do. You'll forgive me for listening to them. |
In response to Xooxer
|
|
Xooxer wrote:
[...] Plus, you can defer creation of objects you won't need right away, so the world loads quicker for the host, if that's an issue. Correct, but when you are simply immediately creating the object on New(), that's the same thing as initializing it in the declaration, only it takes more work for you and DM. |
In response to Kaioken
|
|
Why should I care and why are you bringing up DP in CP?
|
In response to Xooxer
|
|
Only one problem, now it only edits the last number. I'm trying to be able to edit all numbers in rooms.
|
In response to Lundex
|
|
No idea what you mean.
|
In response to Xooxer
|
|
Ok, I have a command called redit which redits the name of the room. Syntax is redit <id> <newname>.
Now when I create a new room. I use redit 1 newname to edit the new room's name. Now when I create a new room, I can't edit the last room I created. So I'm trying to figure out how if I create a new room, how I can edit the last room. Because with the current code I can't. |