ID:169939
 
Is it possible to add every obj in to a list without having created it on the map first?
Just don't give it a location to be created at.
var/list/L = list(new/obj)
// Which is the same as...
var/list/L = list(new/obj(null))
In response to Yota
mob
verb
Test()
var/list/All = list()
All = list(new/obj)
for(var/obj/swords/two/B in All)
world << "yes"


I don't get the "yes" debug message.
In response to DeathAwaitsU
Look up the 'typesof()' proc.
In response to Nadrew
var/list/All = typesof(/obj/swords)

mob
verb
All()
for(var/obj/swords/two/B in All)
world << "yes"


Still no message.
In response to DeathAwaitsU
typesof() doesn't return a list of objects it returns a list of typepaths.

Try something like:

mob
verb
All()
for(var/S in typesof(/obj/sword)-/obj/sword)
//Since the /obj/sword probably isn't anything, don't include it.
world << S //Outputs type path
var/obj/sword/MySword = new S
//Create a new prototype to access some variables
world << MySword.name
//Just for debugging.
In response to Nadrew
Thanks for the help.

Two more questions;

    for(var/obj/a in All)
if(a)
world << "do it"
sleep(10)
new a
a.loc = locate(1,1,1)
else world << "no"


I get the do it message but I also get a runtime error:

runtime error: Cannot create objects of type /obj/swords/coolswords.
proc name: sort (/mob/proc/sort)
source file: Procs.dm,27
usr: DeathAwaitsU (/mob)
src: DeathAwaitsU (/mob)
call stack:
DeathAwaitsU (/mob): sort()
DeathAwaitsU (/mob): start()

Line 27 is new a.

Also;

var/x = "god"


Is there any way to automaticaly adjust the case of the first letter of that variable to be a capital?
In response to DeathAwaitsU
Legal bump.

Also some help with my Get Number topic would help.
In response to DeathAwaitsU
DeathAwaitsU wrote:
Thanks for the help.

Two more questions;

>   for(var/obj/a in All)
> if(a)
> world << "do it"
> sleep(10)
> new a
> a.loc = locate(1,1,1)
> else world << "no"
>

I get the do it message but I also get a runtime error:

runtime error: Cannot create objects of type /obj/swords/coolswords.
proc name: sort (/mob/proc/sort)
source file: Procs.dm,27
usr: DeathAwaitsU (/mob)
src: DeathAwaitsU (/mob)
call stack:
DeathAwaitsU (/mob): sort()
DeathAwaitsU (/mob): start()

Line 27 is new a.

First of all 'a' is an object here, or at least it should be. Next, 'new a' alone won't do anything. You need something like... 'a = new a.type'

Also;

> var/x = "god"
>

Is there any way to automaticaly adjust the case of the first letter of that variable to be a capital?

var/x = "god"
x = uppertext(copytext(x, 1, 2)) + copytext(x, 2)
In response to Yota
var/x = "god"
x = uppertext(copytext(x, 1, 2)) + copytext(x, 2)) //You forgot an ')' at the end.


/me 'kicks Yota.

=P

-Ryan
In response to Ryne Rekab
var/x = "god"
x = uppertext(copytext(x, 1, 2)) + copytext(x, 2) //You added an extra ')' at the end.


/me 'kicks Ryne Rekab.

=P

-YMIHere
In response to YMIHere
/me 'kicks Ryne Rekab

/me 'wonders back into the wilderness...

-Ryan