ID:265001
 
Code:
mob/var
list/Bugs

mob/proc
BugsList()
if(!src.Bugs){src<<"No active Bug Reports!";return}
var/i
for(i in src.Bugs)
src<<"-[i]<br>"
continue


Problem description:It works fine when the list is empty, calls properly but when there is something in this list (for bug reports) it doesn't show anything at all in game. Can anyone help?
Thanks for any and all replies.

You're not creating the list.

mob/var
list/Bugs = new; // Add a new.

In response to Ocean King
Still having the same problems. Thanks for helping me out though. Lol you probably think im an idiot since i post on here rather often.xD
In response to Quiet Screams
Quiet Screams wrote:
Still having the same problems. Thanks for helping me out though. Lol you probably think im an idiot since i post on here rather often.xD

No, why you would be an idiot? I have asked many questions before. (Other accounts :P)

However, it's strange this works fine for me:

mob/var
list/Bugs = new;

mob/verb
AddBug(a as text)
Bugs += a;

BugsList()
if(!src.Bugs){src<<"No active Bug Reports!";return}
var/i
for(i in src.Bugs)
src<<"-[i]<br>"
continue
In response to Ocean King
Edit: why cant i delete this post.

(It was coding but its been changed so i deleted it all.)
In response to Quiet Screams
Omg. i just made a quick Achievements thing and for some reason its showing that list but it refuses to show the bugs. like the game doesnt want to be madeeeee. WTF lol

mob/var
list/Bugs = new;
list/Achievements = new;


CheckAchievements()
var/A
var/Achivs
for(A in Achievements)
usr<<"-[A]"
Achivs++
usr<<"You have [Achivs] Achiements!"

mob/proc
mob/proc
BugsList()
if(!Bugs) {src<<"No active Bug Reports!";return}
var/A
var/bugnum
for(A in Bugs)
src<<"-[A]<br>"
bugnum++
src<<"There are [bugnum] reported bugs."


Cheri_Berry
icon='Items.dmi'
icon_state="Cheri Berry"
canStack=1
verb/Use()
if(usr.paralyzed){view()<<"[usr] used a Cheri Berry and is no longer paralyzed!"}
else{usr<<"It will have no effect!"}
verb/Hold()
alert("ACHIVEMENT!<br>Strong Grip!")
usr.Achievements+="Strong Grip!"
var/origsuffix=suffix
if(!usr.holding){usr.holding="Cheri Berry";usr<<"You are now holding a Cheri Berry!";suffix="[origsuffix] <b>Holding</b>"}
if(usr.holding){usr.holding=null;usr<<"You are no longer holding a Cheri Berry!";suffix=origsuffix}


ReportBug()
alert("Please check to see if this bug has already been reported first")
src.BugsList()
sleep(25)
switch(alert("Report this bug?","Report this bug?","Yes","No"))
if("No")
return
if("Yes")
alert("Please include what you were doing at the moment you found this bug as well as what attack you used and what Pokemon you are, if it applies")
var/x = input("Report a Bug","New Bug or Glitch")
if(!x){return}
var/y=x+"<br><b>-Reported by [usr]</b><br>"
Bugs += y
alert("Thank you for helping out")

Whats the difference between the achievements and bug reports?

------------------------
Everything below this line was edited in after i made this post
Oh for the bugs im assigning it to everyone in the game....hmm

There is absolutely no reason for this to not work. I even made the proc into a verb form and used usr instead of src. other than that, and still got the same problem. theyre exactly the same.

The bug counter doesnt give a number at all. that variable is null even though it detects that the list is not empty.

WTF is going on... Lol

                if(!y){src<<"Nothing was there..."}

Tried this and didn't receive the message so var/y isn't null...

                src<<"[y]"

This gave me var/y exactly as i would expect it to show up when showing the bugs initially...
In response to Quiet Screams
See my last post for all of the coding. I have two different lists coded the exact same way but one doesnt show up when i try to view it (the bugs list)

and the Achievements which works great.
In response to Quiet Screams
Huh. Try this:

var {
list/Bugs = new;
}

mob/verb {
AddBug(Bug as text) {
Bugs += Bug;
}

BugList() {
if(!Bugs) {
src << "Bug list isn't defined.";
}
for(var/Object in Bugs) {
src << Object;
}
src << "There are [Bugs.len] Bugs Report";
}
}


This returned to me:

There are 0 Bugs Report // Called first time without adding a bug.
There are 0 Bugs Report // Called second time without adding a bug.
xd // Added first bug
Lol // Added second bug
There are 2 Bugs Report // Returned that there are 2 bugs.
In response to Ocean King
mob/proc
BugsList() {
if(!Bugs) {
src<<"No active Bug Reports!";return
}
for(var/O in Bugs) {
src << O;
}
src<<"There are [Bugs.len] reported bugs."

}


Its acting as if I want it to read back 'A.len' but i clearly dont have it coded that way...
Do the semi colons make a difference?

runtime error: Cannot read "dght
-Reported by Quiet ...".len
proc name: BugsList (/mob/proc/BugsList)
usr: Quiet Screams (/mob/Bulbasaur)
src: Quiet Screams (/mob/Bulbasaur)
call stack:
Quiet Screams (/mob/Bulbasaur): BugsList()
Quiet Screams (/mob/Bulbasaur): ReportBug()
runtime error: Cannot read
--------------------------------
mob/proc
BugsList() {
if(!Bugs) {
src<<"No active Bug Reports!";return
}
var/count
for(var/O in Bugs) {
src << O;
count++

}
src<<"There are [count] reported bugs."

This goes back to the original problem of recognizing something in the list but still coming up as a null count.
In response to Quiet Screams
still having this problem. Can anyone help?
In response to Quiet Screams
I copy and pasted your previous code (the one including the Cheri Berry)) and found nothing wrong with it. All I have done is removed the unnecessary code and ended up with:

mob/var
list/Bugs = new;

mob/proc
BugsList()
if(!Bugs) {src<<"No active Bug Reports!";return}
var/A
var/bugnum
for(A in Bugs)
src<<"-[A]<br>"
bugnum++
src<<"There are [bugnum] reported bugs."

mob/verb
ReportBug()
alert("Please check to see if this bug has already been reported first")
src.BugsList()
sleep(25)
switch(alert("Report this bug?","Report this bug?","Yes","No"))
if("No")
return
if("Yes")
alert("Please include what you were doing at the moment you found this bug as well as what attack you used and what Pokemon you are, if it applies")
var/x = input("Report a Bug","New Bug or Glitch")
if(!x){return}
var/y=x+"<br><b>-Reported by [usr]</b><br>"
Bugs += y
alert("Thank you for helping out")

I compiled and ran in a new world and the verb worked fine. Perhaps is only to do with the placing of your code?
In response to Quiet Screams
The error message should tell you all you need to know:
runtime error: Cannot read "dght-Reported by Quiet ...".len

"Bugs" is set to a text string, and not a /list. So, either you aren't initializing Bugs as a new /list, and it is null when you're adding something to it (in which case it will just become what you're adding); or you're setting "Bugs" directly to the report message instead of adding it to it.