ID:170376
 
How can I make it to where:
1. When you walk up to a phone, it asks you to put in a
phone number, and
2. it causes the phone with the assigned number to ring and
3. the user who answers the phone gets to hold a private
conversation with the person who made the call.

I already have it worked out so that there is a phone company who will give out phone numbers and there will be monthly bills, seperate phonelines if needed, etc. All I need to do is figure out how to make the number work.
Also, I need to figure out how to make it to where when you go to the phone company you have to give your adress so that it will give your phone that number, nobody elses.
Hmm, this is my first post since a while, let's see...

----------------------------------------------------

mob/var/PhoneNumber = 0000000
mob/var/Person

obj/Phone/verb/Pickup()
var/PN = input(usr, "Dial number:", "Dial Number") as num
for(var/mob/M in world)
if(M.PhoneNumber == PN)
var/MSG = input(usr, "Message?", "Message") as text
M << MSG

if(M.PhoneNumber != PN)
usr << "Unregistered number!"

-----------------------------------------------------
In response to Super Squirrel
Heh, I hope that works, it's been a while.
In response to Super Squirrel
Super Squirrel wrote:
Hmm, this is my first post since a while, let's see...

----------------------------------------------------

mob/var/PhoneNumber = 0000000
mob/var/Person

obj/Phone/verb/Pickup()
var/PN = input(usr, "Dial number:", "Dial Number") as num
for(var/mob/M in world)
if(M.PhoneNumber == PN)
var/MSG = input(usr, "Message?", "Message") as text
M << MSG

if(M.PhoneNumber != PN)
usr << "Unregistered number!"

-----------------------------------------------------

Looping through every mob in the world to find the one with the right phone number is definitely the wrong way to go. Using an actual number for the phone number instead of text really isn't a good idea either.

This is a job for associative lists. What's needed is some sort of central directory that can be loaded and saved, which points to the key of the mob to be reached (or some other info if you can call more than players). If that mob is not connected, the phone should simply not answer.

Lummox JR
In response to Super Squirrel
Woah! I've never seen so many errors in one bit of code in my life. it gave me a general idea though, so i'll try to fix it...
In response to Jamesburrow
Were they indentation errors? If they were that is 100 % your fault for copying and pasting.
In response to Jamesburrow
Heh, <_< I told you it's been a while... I've been focusing on my "pwnzing" icon skillz.
In response to Lummox JR
That's a good idea. You don't want to call their house or something just to find out their not home and you just wasted your time, but what if you want a number so only your friends could call you?
In response to N1ghtW1ng
Nope:
---------
loading BYOND Life.dme
turf-area.dm:1:error: Bad input type
turf-area.dm:1:error: Bad input type: usr
turf-area.dm:1:error: Bad input type: <<
turf-area.dm:1:error: Bad input type: PN
turf-area.dm:1:error: Bad input type: M.PhoneNumber
turf-area.dm:1:error: input type (M.PhoneNumber) must be atomic (area, turf, obj, or mob).
turf-area.dm:1:error: Bad input type: !=
turf-area.dm:1:error: Bad input type: if
turf-area.dm:1:error: Bad input type: MSG
turf-area.dm:1:error: Bad input type: M
turf-area.dm:1:error: Bad input type: <<
turf-area.dm:1:error: Bad input type
turf-area.dm:1:error: Bad input type
turf-area.dm:1:error: Bad input type
turf-area.dm:1:error: Bad input type: usr
turf-area.dm:1:error: Bad input type: input
turf-area.dm:1:error: Bad input type: var/MSG
turf-area.dm:1:error: input type (var/MSG) must be atomic (area, turf, obj, or mob).
turf-area.dm:1:error: Bad input type: =
turf-area.dm:1:error: Bad input type: PN
turf-area.dm:1:error: Bad input type: M.PhoneNumber
turf-area.dm:1:error: input type (M.PhoneNumber) must be atomic (area, turf, obj, or mob).
turf-area.dm:1:error: Bad input type: ==
turf-area.dm:1:error: Bad input type: if
turf-area.dm:1:error: Bad input type: world
turf-area.dm:1:error: Bad input type: var/mob/M
turf-area.dm:1:error: input type (var/mob/M) must be atomic (area, turf, obj, or mob).
turf-area.dm:1:error: Bad input type: in
turf-area.dm:1:error: Bad input type: for

BYOND Life.dmb - 29 errors, 0 warnings (double-click on an error to jump to it)
-------
Also, it registered as it all being under turf-area.dm:1 even though it had its own seperate file (called "phone") and it was not all on line one.
In response to Jamesburrow
Jamesburrow wrote:
That's a good idea. You don't want to call their house or something just to find out their not home and you just wasted your time, but what if you want a number so only your friends could call you?

Programmatically it's all the same; you'd just need another way of flagging whether the phone number is private. The actual means of connecting it to a person shouldn't change.

Lummox JR
yeah about this.. it would be easier for coders to understand if u posted the phone company code. please do that and i will post a better working code!
In response to Robertg0123
Um..the thread is about 5-6 months old...0_0