SphereServer BugTracker - SphereServer
View Issue Details
0002368SphereServerexecutable - windows buildpublic25-06-14 01:3613-07-14 17:17
Coruja 
Ben 
normalminoralways
closedno change required 
 
 
Automated (specify build number)
None
None
0002368: MIDILIST console error
When the function MIDILIST is called on a NPC, sphere will return this console error:
20:34:ERROR:(sphere_region.scp,183)Undefined keyword 'MIDILIST'

This error doesn't make sense, because MIDILIST is working fine -on players- but if called on NPC it will return 'undefined keyword', this text is wrong because ppl will think that this function have some problem or doesn't exist.


to prevent this, MIDILIST always must check for ISPLAYER before called. Of course NPCs can't listen to MIDILIST, but I think this check must be done internally on sphere, like it was on SOUND function


[REGIONTYPE r_something]
ON=@Enter
IF (<SRC.ISPLAYER>)
 SRC.MIDILIST=midi_approach //this must check for ISPLAYER to prevent console error
ENDIF

ON=@RegPeriodic
SRC.SOUND={021f 1 0243 1 0244 1 0245 1} //this can be used without any check
No tags attached.
Issue History
25-06-14 01:36CorujaNew Issue
25-06-14 03:33FeehNote Added: 0002306
13-07-14 17:17BenNote Added: 0002328
13-07-14 17:17BenStatusnew => closed
13-07-14 17:17BenAssigned To => Ben
13-07-14 17:17BenResolutionopen => no change required

Notes
(0002306)
Feeh   
25-06-14 03:33   
The problem here is that Player and NPC's are different objects internally.
Both derives from Char object but one is Client object and other is CharNPC, so, a Client can access Char functions and CharNPC can also access char functions, but a Client can not access CharNPC function (or vice versa) even if they are derived from the same object.

MIDILIST is defined inside Client object. Since scripts does not hold any information related to what object we are holding (rather than its reference), when you 'SRC.MIDILIST=xyz' you are saying to call MIDILIST verb on whatever object SRC reference is holding

SOUND is a bit different, I see it as a sound source / make a game object emit a sound. It is defined on ObjBase which is a base to every game object

I see no problem, in fact I'm indifferent about moving MIDILIST to Char object and verifying if the referenced object is a Client or not, but I must agree that it makes sense being a Client verb and not Char's
(0002328)
Ben   
13-07-14 17:17   
As a solution, just use MUSIC instead of MIDILIST.
MUSIC is already defined in sphere_backward_compatibility.scp and checks for isplayer.
You could also override MIDILIST directly to do the same.