-- grandMA Lua Plugin - UDP/TCP SetIP Address -- jason@badgersan.com -- 2018-04-08 local internal_name = select(1,...); local visible_name = select(2,...); gma.echo('Plugin '..internal_name..' was loaded'); -- you will see this message in the system monitor return function() if gmaStringsendIP == nil then gmaStringsendIP = "127.0.0.1" gma.show.setvar('PLUGIN_SEND_IP',gmaStringsendIP) end if gmaStringsendPort == nil then gmaStringsendPort = "1435" gma.show.setvar('PLUGIN_SEND_PORT',gmaStringsendPort) end if msgFormat == nil then msgFormat = "udp" gma.show.setvar('PLUGIN_MSG_FORMAT', msgFormat) end combineString = string.format("%s %s:%s",msgFormat,gmaStringsendIP,gmaStringsendPort) changeConfirm = gma.gui.confirm('Current Settings - Change?',combineString) if changeConfirm then tempMsgFormat = gma.textinput('udp or tcp?') if tempMsgFormat == nil or type(tempMsgFormat) ~= "string" then -- Allow for abort return gma.echo('*** Plugin Aborted ***') else tempGmaSendIP = gma.textinput('Enter IP Address to send to') if tempGmaSendIP == nil or type(tempGmaSendIP) ~= "string" then -- Allow for abort return gma.echo('*** Plugin Aborted ***') else tempGmaSendPort = gma.textinput('Enter Port to send to') if tempGmaSendPort == nil or type(tempGmaSendPort) ~= "string" then -- Allow for abort return gma.echo('*** Plugin Aborted ***') else tempCombineString = string.format("%s %s:%s",tempMsgFormat,tempGmaSendIP,tempGmaSendPort) dataConfirm = gma.gui.confirm('Is this correct?',tempCombineString) if dataConfirm then gma.show.setvar('PLUGIN_SEND_IP',tempGmaSendIP) gma.show.setvar('PLUGIN_SEND_PORT',tempGmaSendPort) gma.show.setvar('PLUGIN_MSG_FORMAT',tempMsgFormat) gma.echo('*** '..tempMsgFormat..' IP Destination set to '..tempGmaSendIP..':'..tempGmaSendPort..' ***') gma.feedback('Send '..tempMsgFormat..' : IP set to '..tempGmaSendIP..':'..tempGmaSendPort..'') else return gma.echo('*** User Aborted Plugin ***') end end end end else gma.echo('*** User Aborted Plugin ***') gma.feedback('Plugin Aborted') end end