ID:150115
 
I made closed.dmi and open.dmi what more do I have to do in order for the key code to work? what od i defiine? im not the original user im just subbing for Brandon while hes gone. Can somebody/anybody help out? thank you to whoever. heres the errors with this....please hep fix them-->


loading Knightsoftheround.dme
Key.dm:25:error:O:undefined type: O
Key.dm:26:error:O.keycode:undefined type: O.keycode
Key.dm:19:error:newkey.keycode:bad var
Key.dm:20:error:newkey.name:bad var
Key.dm:20:error:newkey.codekey:bad var
Key.dm:18:newkey :warning: variable defined but not used
Key.dm:25:O :warning: variable defined but not used

how do i make variables?




obj/door
var/keycode
var/locked = 0 as num
var/open = 0 as num
icon='closed.dmi'
density = 1
opacity = 1
New()
..()
anchor
keycode = "[rand(1,4)][rand(1,4)][rand(1,4)][rand(1,4)]"
for(var/obj/door/O in world)
if(O.keycode == src.keycode)
goto anchor
src.name = "Door [src.keycode]"
verb/MakeKey()
set src in oview(1)
var/newkey = new /obj/key (usr)
newkey.keycode = src.keycode
newkey.name = "Key [newkey.codekey]"
verb/LockUnlock()
set src in oview(1)
set name = "Lock/Unlock Door"
var/keysmatched = 0 as num
for(var/obj/Key/O in usr.contents)
if(O.keycode == src.keycode)
keysmatched += 1
if(keysmatched > 0)
if(!src.locked)
src.locked = 1
else
src.locked = 0
verb/OpenClose()
set src in oview(1)
set name = "Open/Close Door"
if(!src.locked)
if(src.open)
src.open = 0
src.icon = 'closed.dmi'
src.density = 1
src.opacity = 1
else
src.open = 1
src.icon = 'open.dmi'
src.density = 0
src.opacity = 0
else
usr << "The door is locked."
obj/key/var/keycode
Making a variable is easy

var
blah = 1000//these are the variables
MAXblah=1000

That is an example of how to add variables,i cant help you with the rest sorry.
In response to Super saiyan3
still having problems, with the code.
somebody save me, im no good at this stuff.

In response to Migzor
Here's a example code:

obj
var
keyneeded
keyname

obj/Key
icon='keys.dmi'

obj/Door
icon='doors.dmi'
icon_state="closed"
density=1
opacity=1
verb/Open()
for(var/obj/Key/K in usr)
if(K.keyname == src.keyneeded)
src.icon_state="open"
src.density=0
src.opacity=0
else
usr<<"You don't have the proper key!"

mob/verb/Make_key()
var/Name = input("What name shall you give this key?")
var/keymade = new/obj/Key(usr.loc)
keymade.keyname=Name

mob/verb/Make_door()
var/Needed = input("What key is needed for this door?")
var/doormade = new/obj/Door(usr.loc)
doormade.keyneeded=Needed


You can set the names and keyneeded vars in the editor by right clicking on the object and going to "Edit".
In response to Nadrew
i dont see edit Nadrew, maybe im retarded.
you mean the window that you type in

obj/Door

or something is pops up sometimes, but how do i ge tto it to put in the new Vars?
In response to Migzor
Right click on a door on your map and click "Edit" on the menu that pops up, the thing that pops up lists all the vars.
In response to Nadrew
I DONT get this part of the code one bit


obj/Door
icon='Closed.dmi'
density=1
opacity=1
verb/Open()
for(var/obj/Key/K in usr)
if(K.keyname == src.keyneeded)
src.icon_state="open"
src.density=0
src.opacity=0
else
usr<<"You don't have the proper key!"

mob/verb/Make_key()
var/Name = input("What name shall you give this key?")
var/keymade = new/obj/Key(usr.loc)
keymade.keyname=null

mob/verb/Make_door()
var/Needed = input("What key is needed for this door?")
var/doormade = new/obj/Door(usr.loc)
doormade.keyneeded=null
In response to Nadrew
mob/verb/Make_key()
var/Name = input("What name shall you give this key?")
var/keymade = new/obj/Key(usr.loc)
keymade.keyname=Name

mob/verb/Make_door()
var/Needed = input("What key is needed for this door?")
var/doormade = new/obj/Door(usr.loc)
doormade.keyneeded=Needed


What would i put for key Needed and Keyname?
im sorry i haev no clue of what to do
In response to Migzor
Why did you set it to null? That code was so you can make doors and keys at run-time, the input for the key is to name the key, and the one for the door is to name what key you want it to work with.
I've made a demo of this, but it's compiled with 307, and I don't feel like recompiling it for 306 use.
In response to Nadrew
just think for a sec. if you did re compile your key system thing, it would help alot of byond'ers out there.
In response to Migzor
Sorry no can do, I'm on a slow connection, so downloading 306 again would be too much work, so you'll have to wait till you're up-to-date.
In response to Nadrew
Nadrew wrote:
Sorry no can do, I'm on a slow connection, so downloading 306 again would be too much work, so you'll have to wait till you're up-to-date.

What if he downloads the Beta-test (307b12) version? Would your program work on that?
In response to Bingis
Bingis wrote:
What if he downloads the Beta-test (307b12) version? Would your program work on that?


Yup, it'd work fine then, but I still probably wouldn't release it untill 307 is public (And Migzor couldn't have it anyways, he was mean to me).
In response to Nadrew
suck it up Nadrew, i was messing with you cause you would never answer my questions.
In response to Migzor
I'm sorry, I don't believe you. I won't be releasing my door locks demo.
In response to Nadrew
can u help me on this plz,
i'm new at this but i'm alright i need my game to have doors which need keys to open them. HELP! PLZ
In response to Sanj121
Maybe, if I could understand what you wrote I'd be able to help you with whatever you need.
In response to Nadrew
well, then help me get $500 grand!
In response to Migzor
Will that be in BYONDimes?
Page: 1 2