The following is code from my text mud game. I was curious if there was a better way to write any of these?
note- axo means nothing just turn to 1 to term loop?? faster?
note- axo means nothing just turn to 1 to term loop?? faster?
Function AddAlsohere(p.player) curr_id=0 axo=0:xa=0 While axo=0 If area(p\curr_area)\ro[p\curr_room]\ro2[xa]=Null Then area(p\curr_area)\ro[p\curr_room]\ro2[xa]=New alsohere area(p\curr_area)\ro[p\curr_room]\ro2[xa]\alsoname$=Lower$(p\name$) area(p\curr_area)\ro[p\curr_room]\ro2[xa]\playerid=p\playerid p\alsoid=xa axo=1 EndIf xa=xa+1 Wend ;writeLine p\stream, area(p\curr_area)\ro[p\curr_room]\ro2[p\alsoid]\alsoname$+" added ID: "+p\alsoid End Function
Function DeleteAlsohere(p.player) xa=p\alsoid WriteLine p\stream, "Deleting ID: "+p\alsoid+" from "+area(p\curr_area)\ro[p\curr_room]\roomname$ Delete area(p\curr_area)\ro[p\curr_room]\ro2[p\alsoid] xa=xa+1 axo=0 Print xa While axo=0 If area(p\curr_area)\ro[p\curr_room]\ro2[xa]<>Null Then xa2=xa-1 area(p\curr_area)\ro[p\curr_room]\ro2[xa2]=New alsohere area(p\curr_area)\ro[p\curr_room]\ro2[xa2]\playerid=area(p\curr_area)\ro[p\curr_room]\ro2[xa]\playerid area(p\curr_area)\ro[p\curr_room]\ro2[xa2]\alsoname$=area(p\curr_area)\ro[p\curr_room]\ro2[xa]\alsoname$ playerx=area(p\curr_area)\ro[p\curr_room]\ro2[xa2]\playerid pl(playerx)\alsoid=xa2 WriteLine pl(playerx)\stream, "Your also ID has been changed to "+p\alsoid Delete area(p\curr_area)\ro[p\curr_room]\ro2[xa] Else axo=1 EndIf xa=xa+1 Wend End Function