// This file is just used for test purposes // I suppose you could use this to display the result as well... void displayResult(MXPResult res, StringBuffer output ) { switch (res.type) { case 0: { // do nothing output.append("Nothing.\n"); } break; case 1: { String s = (String) res.data; // i think if TRUE, output a newlines if not output regular text if (s.equals("\r\n")) //newlines are always sent separately output.append("\n"); else output.append(s); } break; case 2: { int t = (Integer) res.data; // not sure what this is used for output.append("Line tag: "+t+"\n"); } break; case 3: { flagStruct fs = (flagStruct) res.data; // this tells ya the name of the flags receieved, like start room or start actor, basically server defined // elements, this should be hidden and not output anything to the screen // However, some of these things can be used for automappers, // In wintin.net, under mxp variables, these show room names, room descriptions, etc. Ive sent you a screen shot of this also. // so these are a type of variable but can be more than one word // properties tags to be used by the server in !ELEMENT definitions. if (fs.begin) output.append("Start of flag: "+fs.name+"\n"); else output.append("End of flag: "+fs.name+"\n"); } break; case 4: { varStruct vs = (varStruct) res.data; if (vs.erase) // if this is TRUE, need to delete/remove the global variable output.append("Erase variable: "+vs.name+"\n"); else output.append("Variable: "+vs.name+", value: "+vs.value+"\n"); } break; case 5: { formatStruct fs = (formatStruct) res.data; // check to see if true, if so do what it says to inside the formatStruct int mask = fs.usemask; if ((mask & formatStruct.USE_BOLD) != 0 ) // if this is true, the output of text needs to be bolded output.append("Formatting: "+ (((fs.attributes & libmxp.Bold) != 0 ) ? "bold" : "not bold")+"\n"); if ((mask & formatStruct.USE_ITALICS) != 0 ) // if this is true, the output of text needs to be italic output.append("Formatting: "+ (((fs.attributes & libmxp.Italic) != 0 ) ? "italics" : "not italics")+"\n"); if ((mask & formatStruct.USE_UNDERLINE) != 0 ) // if this is true, the output of text needs to be underlined output.append("Formatting: "+ (((fs.attributes & libmxp.Underline) != 0 ) ? "underline" : "not underline")+"\n"); if ((mask & formatStruct.USE_STRIKEOUT) != 0 ) // if this is true, the output of text needs to be strikeout output.append("Formatting: "+ (((fs.attributes & libmxp.Strikeout) != 0 ) ? "strikeout" : "not strikeout")+"\n"); if ((mask & formatStruct.USE_FG) != 0 ) //Set the color of the text. If the background color is omitted, the current background color is used. // you probably should not allow this, just reply back do not support output.append( String.format("Formatting: foreground color (%d, %d, %d)\n", fs.fg.getRed(), fs.fg.getGreen(), fs.fg.getBlue())); if ((mask & formatStruct.USE_BG) != 0 ) // changes color of the background // you probably should not allow this, just reply back do not support output.append( String.format("Formatting: background color (%d, %d, %d)\n", fs.bg.getRed(), fs.bg.getGreen(), fs.bg.getBlue())); if ((mask & formatStruct.USE_FONT) != 0 ) // if this is true, use formatStruct.USE_FONT pointer as the style of font to use(might not allow this) output.append( String.format("Formatting: font "+fs.font+"\n")); if ((mask & formatStruct.USE_SIZE) != 0 ) // if this is TRUE, use formatStruct.USE_SIZE pointer to determine size of text to output(might not allow this) output.append( String.format("Formatting: size %d\n", fs.size)); } break; case 6: { linkStruct ls = (linkStruct) res.data; // all data is kept in linkStruct // the client should recognize a URL either with http or with www // the text should be output in blue and underlined, when clicked it should open the browser and send a person to that website // the hint option is used if you want to add something such as (Click here to send your browser to URL) output.append( String.format("URL link: name %s, URL %s, text %s, hint %s\n", ls.name, ls.url, ls.text, ls.hint)); } break; case 7: { SendStruct ss = (SendStruct) res.data; // this is an action link also, it sends commands through. // the text is normally output with blue text and underlined // if the server sends several hints, such as the following line: they will be split up using the | bar // <SEND \"at %d %s|at %d look %s|at %d scan %s|at %d close %s %s\" hint=\"Go|Go|Look|Scan|Close\">%s</SEND> // I have attached a screen shot of what this looks like with wintin.net inside of slothmud output.append( String.format("Send link: name %s, command %s, text %s, hint %s, to prompt: %s, menu: %s\n", ss.name, ss.command, ss.text, ss.hint, (ss.toprompt?"yes":"no"), (ss.ismenu?"yes":"no"))); } break; case 8: { String c = (String)res.data; //The <EXPIRE> tag is used to remove links previously displayed with the <A> or <SEND> tags. //For example, when moving to a new room, <SEND> links from the previous room description are no longer //valid and need to be removed. To accomplish this, you create a Name for the tags that you want removed. //Then you specify this name in the <EXPIRE> tag. output.append("Expire: "+c+"\n"); } break; case 9: { String c = (String)res.data; output.append("Send this: "+c+"\n"); } break; case 10: { output.append("Horizontal line\n"); } break; case 11: { soundStruct ss = (soundStruct) res.data; if (ss.isSOUND) output.append( String.format("Sound: file %s, URL %s, volume %d, %d repeats, priority %d, type %s\n", ss.fname, ss.url, ss.vol, ss.repeats, ss.priority, ss.type)); else output.append( String.format("Music: file %s, URL %s, volume %d, %d repeats, continue %s, type %s\n", ss.fname, ss.url, ss.vol, ss.repeats, (ss.continuemusic?"yes":"no"), ss.type)); } break; case 12: { windowStruct ws = (windowStruct) res.data; output.append( String.format("Create window: name %s, title %s, left %d, top %d, width %d, height %d, scrolling %s, floating %s\n", ws.name, ws.title, ws.left, ws.top, ws.width, ws.height, (ws.scrolling?"yes":"no"), (ws.floating?"yes":"no"))); } break; case 13: { internalWindowStruct ws = (internalWindowStruct) res.data; String s = "none"; switch (ws.align) { case Left: s = "left"; break; case Right: s = "right"; break; case Bottom: s = "bottom"; break; case Top: s = "top"; break; case Middle: s = "middle (invalid!)"; break; }; output.append( String.format("Create internal window: name %s, title %s, align %s, scrolling %s\n", ws.name, ws.title, s, (ws.scrolling?"yes":"no"))); } break; case 14: { String s = (String)res.data; output.append( String.format("Close window: %s\n", s)); } break; case 15: { String s = (String)res.data; output.append( String.format("Set active window: %s\n", s)); } break; case 16: { moveStruct ms = (moveStruct) res.data; output.append( String.format("Move cursor: X=%d, Y=%d\n", ms.x, ms.y)); } break; case 17: { output.append( String.format("Erase text: %s\n", ((res.data!=null) ? "rest of frame" : "rest of line"))); } break; case 18: { relocateStruct rs = (relocateStruct) res.data; output.append( String.format("Relocate: server %s, port %d\n", rs.server, rs.port)); } break; case 19: { output.append( ((Boolean)res.data) ? "Send username\n" : "Send password\n"); } break; case 20: { imageStruct is = (imageStruct) res.data; String s = ""; switch (is.align) { case Left: s = "left"; break; case Right: s = "right"; break; case Bottom: s = "bottom"; break; case Top: s = "top"; break; case Middle: s = "middle"; break; }; output.append( String.format("Image: name %s, URL %s, type %s, height %d, width %d, hspace %d, vspace %d, align %s\n", is.fname, is.url, is.type, is.height, is.width, is.hspace, is.vspace, s)); } break; case 21: { String s = (String)res.data; output.append( String.format("Image map: %s\n", s)); } break; case 22: { gaugeStruct gs = (gaugeStruct) res.data; output.append( String.format("Gauge: variable %s, max.variable %s, caption %s, color (%d, %d, %d)\n", gs.variable, gs.maxvariable, gs.caption, gs.color.getRed(), gs.color.getGreen(), gs.color.getBlue())); } break; case 23: { statStruct ss = (statStruct) res.data; output.append( String.format("Status bar: variable %s, max.variable %s, caption %s\n", ss.variable, ss.maxvariable, ss.caption)); } break; case -1: { String s = (String)res.data; output.append( String.format("Error: %s\n", s)); } break; case -2: { String s = (String)res.data; output.append( String.format("Warning: %s\n", s)); } break; } }