ID:145634
 
Code: /mob/staff/verb/
            Demote()
set category = "Game Mod"
var/list/stafftrial=new
for(var/d in staff) stafftrial+=d
for(var/b in trialstaff) stafftrial+=b
var/x=input("Who do you want to demote?","Demote")as null|anything in stafftrial
if(!x) return
if(x==ckey) {src<<"You cannot demote yourself.";return}
if(alert("Are you sure you want to demote [x]?",,"Yes","No")=="Yes")
if(x in staff)
staff-=x
world<<"[x] has been demoted from staff by [src]."
if(x in trialstaff)
trialstaff-=x
world<<"[x] has been demoted from trialstaff by [src]."
for(var/mob/t in world) if(t.client) if(t.ckey==x) {t.verbs-=typesof(/mob/Trial/verb,/mob/staff/verb);break}


Problem description: I get a compile error- Testing.dm:36:error:/mob/staff/verb: compile failed (possible infinite cross-reference loop)

I often have this problem too. You can't minus a verb from inside that verb. Try minusing it with a procedure. I am not totally sure, however I think I am right.



-Doh
Are you already using <code>typesof()</code> for the typepath: <code>/mob/staff/verb</code> ?

O-matic
In response to O-matic
Yes, I am.
In response to Artemio
Artemio wrote:
Yes, I am.

Then that is the cause of your problem, you can't use <code>typesof()</code> on the same typepath more than once. Don't ask me why, because I don't have a clue =P.

O-matic
Hrm, I'm not coming up with any solutions to ridding yourself of the cross-reference loop. I guess you may have to do it the long way, and do things like:
t.verbs-=/mob/staff/verb/Demote
t.verbs-=/mob/staff/verb/blah
// etc.


Hiead
That would be because Demote() is defined under mob/staff/verb. Or mob/trial/verb. Call a procedure that does the adding/subtracting, possibly?
In response to O-matic
O-matic wrote:
Artemio wrote:
Yes, I am.

Then that is the cause of your problem, you can't use <code>typesof()</code> on the same typepath more than once. Don't ask me why, because I don't have a clue =P.

Boy, you weren't kidding on that last part!

You can in fact call typesof() more than once per type path. If this wasn't working for you, you were doing something incredibly wrong.

Lummox JR
This is a simple problem of hierarchy. You're allowing staff to demote each other, so the verb is defined under the very type path it's trying to use in typesof()--hence the error.

Clearly what you need here is a proc, called by a verb, which allows the host to promote/demote the staff and trial staff, and staff to promote/demote trial staff only.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
O-matic wrote:
Artemio wrote:
Yes, I am.

Then that is the cause of your problem, you can't use <code>typesof()</code> on the same typepath more than once. Don't ask me why, because I don't have a clue =P.

Boy, you weren't kidding on that last part!

You can in fact call typesof() more than once per type path. If this wasn't working for you, you were doing something incredibly wrong.

Lummox JR

Yes, I probably were doing something wrong. I just tested it again and it didn't give any errors this time. Could you, by any chance, guess what I was doing wrong? The error I got was the same as Artemio's... And sorry, Artemio, for the false info <_<.

O-matic
In response to Lummox JR
I'd just like to point out that I figured this out awhile ago due to XxDohxX's post.
In response to O-matic
[link]

He already stated what Artemio was doing wrong, and if you have the same issues, you should probaly take a little peak at that.
In response to Cheetoz
Cheetoz wrote:
[link]

He already stated what Artemio was doing wrong, and if you have the same issues, you should probaly take a little peak at that.

Oh, sorry. I haven't read that post yet.

O-matic