[Script] XML Editor |
![]() ![]() « Citoyen » 1386077820000
| 0 | ||
Can't edit gravity |
0 | ||
I can't start the script I only see "This script was made by..." And nothing more |
![]() ![]() « Citoyen » 1386365640000
| 0 | ||
!map @code for launch ^ |
![]() ![]() « Citoyen » 1386508260000
| 0 | ||
Hey! :I I put a gravity it on valve but the wind changed it.. |
![]() ![]() « Citoyen » 1386519540000
| 0 | ||
can the other person also edit it with you? |
![]() ![]() « Citoyen » 1386530520000
| 0 | ||
I'll update the script soon, please be patient. ^^ |
![]() ![]() « Citoyen » 1386543960000
| 0 | ||
Kmlcan a dit : We look forward to your |
![]() ![]() « Citoyen » 1388155980000
| 0 | ||
can't start the script I only see "This script was made by..." And nothing more !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Plz need script ....update |
![]() ![]() « Citoyen » 1388165880000
| 0 | ||
You have to type !map @code to start it. |
![]() ![]() « Citoyen » 1388168940000
| 0 | ||
Kmlcan a dit : What about gravity ? we can't edit gravity :c |
![]() ![]() « Citoyen » 1388172360000
| 0 | ||
Good job! Can I translate the topic and the script to Portuguese? |
![]() ![]() « Citoyen » 1388178780000
| 0 | ||
Laagaadoo a dit : I'll update the script, but I'm too lazy. ^^' You can translate this after the update. |
![]() ![]() « Citoyen » 1388184060000
| 0 | ||
Kmlcan a dit : Yay finely YEEEEEEEES We will be able to edit gravity :D |
0 | ||
![]() |
![]() ![]() « Consul » 1501282380000
| 0 | ||
Sky_dreams a dit : Kmlcan has not been around for a long time, he left. |
![]() ![]() « Citoyen » 1501350600000
| 0 | ||
admine uyarladıgım versyonu atayım admins={Muutluerkek=1} local xml=nil local author=nil local groundTypes={[0]='Tahta','Buz','Trambolin','Lav','Cikolata','Toprak','Çimen','Kum','Bulut','Su','Taş','KarBiom','Renkli Zmn','Boşluk'} local options={Collision=false, Soulmate=false, Portals=false, Night=false, Wind=0, Gravity=10, Background=nil, Width=800, Height=400} local grounds={} local keys={} local players={} function main() --tfm.exec.newGame() tfm.exec.disableAutoNewGame(true) tfm.exec.disableAutoTimeLeft(true) for name in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end tfm.exec.newGame(tfm.get.room.currentMap) end function readOptions() if xml then options={Collision=false, Soulmate=false, Portals=false, Night=false, Wind=0, Gravity=10, Background=nil, Width=800, Height=400} grounds={} for attr, val in xml:match('<P .->'):gmatch('(%S+)=(%S+)') do if attr == 'C' then options.Collision = true elseif attr == 'A' then options.Soulmate = true elseif attr == 'P' then options.Portals = true elseif attr == 'N' then options.Night = true elseif attr == 'G' then options.Wind, options.Gravity = val:match('"([%-%d]+),([%-%d]+)"') elseif attr == 'F' then options.Background = val:match('"([%-%d]+)"') elseif attr == 'L' then options.Width = val:match('"([%-%d]+)"') elseif attr == 'H' then options.Height = val:match('"([%-%d]+)"') end end local array = {} for attributes in xml:match('<S>(.-)</S>'):gmatch('<S (.-)/>') do array = {} for attr, val in attributes:gmatch('(%S+)="(%S*)"') do array[attr] = val or "" end if array.P then array.P = string.split(array.P or "") end table.insert(grounds, array) end end end function table.swap(t, key, key2) local tmp = t[key] t[key] = t[key2] t[key2] = tmp end function string.split(str, delimiter) local delimiter=delimiter or ',' local array={} for part in str:gmatch('[^'..delimiter..']+') do table.insert(array, part) end return array end function getOptionsText() return string.format("<p align='center'>%s<a href='event:optionCollision'>Çarpışma</a> <G>|%s <a href='event:optionNight'>Gece</a> <G>|%s <a href='event:optionPortals'>Portallar</a> <G>|%s <a href='event:optionSoulmate'>Ruh Eşi</a> <G>|<J> <a href='event:changeGravity'>Gravity: <font color='#c2c2da'>%d</font></a> <G>|<J> <a href='event:changeWind'>Rüzgar: <font color='#c2c2da'>%d</font></a> <G>|<J> <a href='event:changeBackground'>Arka Plan: <font color='#c2c2da'>%s</font></a> <G>|<J> <a href='event:changeL'>Uzunluk: <font color='#c2c2da'>%d</font></a> <G>|<J> <a href='event:changeH'>Yükseklik: <N>%d", options.Collision and '<CH>' or '<R>', options.Night and '<CH>' or '<R>', options.Portals and '<CH>' or '<R>', options.Soulmate and '<CH>' or '<R>', options.Gravity, options.Wind, options.Background or 'Yok', options.Width, options.Height) end function showGUI(name) for nam in pairs(admins) do ui.addTextArea(333,getOptionsText(),nam,40,20,720,nil,1,0,0.8,true) end end function updateGUI() ui.updateTextArea(333,getOptionsText()) end function updateXML() local pTag = xml:match('<P .->') local attributes = {} for attr, val in pTag:gmatch('(%S+)=(%S+)') do attributes[attr] = val end attributes.C = options.Collision and '""' or nil attributes.A = options.Soulmate and '""' or nil attributes.P = options.Portals and '""' or nil attributes.N = options.Night and '""' or nil attributes.L = options.Width and '"' .. options.Width .. '"' or nil attributes.H = options.Height and '"' .. options.Height .. '"' or nil attributes.F = options.Background and '"' .. options.Background .. '"' or nil attributes.G = '"' .. options.Wind .. "," .. options.Gravity .. '"' local newPTag = '<P ' for attr, val in pairs(attributes) do newPTag = newPTag .. attr .. '=' .. val .. ' ' end newPTag = newPTag .. '/>' xml = xml:gsub('<P .->', newPTag, 1) local groundStr = '' local gStr = '' for _, ground in pairs(grounds) do gStr = '' for key, val in pairs(ground) do if key ~= 'P' then gStr = gStr .. key .. '="' .. tostring(val) .. '" ' end end if ground.P then gStr = gStr .. 'P="' .. table.concat(ground.P, ',') .. '" ' end groundStr = groundStr .. string.format('<S %s/>', gStr) end xml = xml:gsub('<S>.-</S>', '<S>'..groundStr..'</S>', 1) print("<bv>XML Uyarlandı.") end function eventNewGame() for nam in pairs(admins) do if tfm.get.room.xmlMapInfo and tfm.get.room.xmlMapInfo.xml and tfm.get.room.currentMap == '@' .. tfm.get.room.xmlMapInfo.mapCode then xml = tfm.get.room.xmlMapInfo.xml print("<r>Map Açıldı.") readOptions() showGUI(name) ui.addTextArea(666,"<p align='center'><a href='event:groundSettings'>Ayarlar</a> <G>| <N><a href='event:reloadMap'>Uygula</a>",nam,300,380,200,nill,1,0,0.8,true) tfm.exec.setGameTime(5) if tfm.get.room.xmlMapInfo and tfm.get.room.xmlMapInfo.author ~= "#Module" and tfm.get.room.xmlMapInfo.xml then author = tfm.get.room.xmlMapInfo.author.." <BL>- @"..tfm.get.room.xmlMapInfo.mapCode tfm.exec.setUIMapName(author) else tfm.exec.setUIMapName(author.." - <VP>Yeni Hali") end else tfm.exec.setUIMapName(tfm.get.room.currentMap) for id=0,985 do ui.removeTextArea(id) end end end end function eventNewPlayer(name) keys[name] = {} players[name]={edit=nil} tfm.exec.bindKeyboard(name, 80, true, true) tfm.exec.bindKeyboard(name, 80, false, true) tfm.exec.bindKeyboard(name, 79, true, true) tfm.exec.bindKeyboard(name, 79, false, true) system.bindMouse(name, true) end function eventPlayerLeft(name) keys[name] = nil end function eventKeyboard(name, key, down) if keys[name] then keys[name][key] = down end end function eventMouse(name, x, y) if keys[name] then if keys[name][80] then tfm.exec.movePlayer(name, x, y) elseif keys[name][79] then local gID = 0 for ID, ground in pairs(grounds) do if math.abs(ground.X-x) < 11 and math.abs(ground.Y-y) < 11 then gID = ID end end if gID ~= 0 then eventTextAreaCallback(ID, name, 'groundEdit'..gID) end end end end function eventChatCommand(name, cmd) if cmd:sub(1,4) == "map " and admins[name] then tfm.exec.newGame(cmd:sub(5)) end end function eventPopupAnswer(ID, name, answer) if ID == 40 then options.Wind = tonumber(answer) or options.Wind elseif ID == 41 then options.Gravity = tonumber(answer) or options.Gravity elseif ID == 42 then if tonumber(answer) then local answer = tonumber(answer) if answer>=0 and answer<=8 then options.Background = answer end elseif answer:lower() == 'x' then options.Background = nil end elseif ID == 43 then if tonumber(answer) then local answer = tonumber(answer) if answer>=800 and answer<=1600 then options.Width = answer end end elseif ID == 44 then if tonumber(answer) then local answer = tonumber(answer) if answer>=400 and answer<=800 then options.Height = answer end end elseif ID == 53 then if players[name] and players[name].edit and players[name].edit.ID and answer:len()>0 then local ground = grounds[players[name].edit.ID] if ground then if players[name].edit.type == 'type' and tonumber(answer)>=0 and tonumber(answer)<=13 then ground.T = tonumber(answer) elseif players[name].edit.type == 'x' then ground.X = tonumber(answer) elseif players[name].edit.type == 'y' then ground.Y = tonumber(answer) elseif players[name].edit.type == 'l' and tonumber(answer)>=10 and tonumber(answer)<=2000 then ground.L = tonumber(answer) elseif players[name].edit.type == 'h' and tonumber(answer)>=10 and tonumber(answer)<=2000 then ground.H = tonumber(answer) elseif players[name].edit.type == 'fri' then ground.P[3] = answer elseif players[name].edit.type == 'res' then ground.P[4] = answer elseif players[name].edit.type == 'angle' then ground.P[5] = answer elseif players[name].edit.type == 'color' and answer:len()>=0 and answer:len()<=6 then ground.o = tonumber(answer) or tonumber('0x'..answer) or 0 end eventTextAreaCallback(ID, name, 'groundEdit'..players[name].edit.ID) end end end updateGUI() end function eventTextAreaCallback(ID, name, callback) if callback=="printxml" then local xml,current=tfm.get.room.xmlMapInfo.xml,0 xml=xml:gsub("<","*"):gsub(",0,",",,") print("<R>"..tfm.get.room.currentMap.." XML:") while #xml>current do current=current+3001 print("<R>"..xml:sub(current-3000,current):gsub("*","<")) end end if callback == 'close' then ui.removeTextArea(ID, name) ui.removeTextArea(121, name) elseif callback:sub(1,6) == 'option' and callback:len() > 6 then options[callback:sub(7)] = not options[callback:sub(7)] updateGUI() elseif callback == 'changeWind' then ui.addPopup(40,2,"<p align='center'>Rüzgar belirlemek için bir değer girin</p>",name,300,55,200,true) elseif callback == 'changeGravity' then ui.addPopup(41,2,"<p align='center'>Gravity'i belirlemek için bir değer girin</p>",name,300,55,200,true) elseif callback == 'changeBackground' then ui.addPopup(42,2,"<p align='center'>Arka plan belirlemek için bir değer girin</p>",name,300,55,200,true) elseif callback == 'changeL' then ui.addPopup(43,2,"<p align='center'>Uzunluğunu belirlemek için bir değer girin</p>",name,300,55,200,true) elseif callback == 'changeH' then ui.addPopup(44,2,"<p align='center'>Yüksekliğini belirlemek için bir değer girin</p>",name,300,55,200,true) elseif callback:sub(1,14) == 'groundSettings' then local startID = callback:sub(15) startID = startID and tonumber(startID) or 1 local groundsStr = '' for i,ground in ipairs(grounds) do if i >= startID then if i >= (startID+8) then break end groundsStr = groundsStr .. '<N>' .. i .. '<G> - <V><a href="event:groundEdit' .. i .. '">' .. (groundTypes[tonumber(ground.T)] or 'Unknown') .. '</a> <G>-<R> <a href="event:groundDel' .. i .. '">Kaldır</a> <G>-<J> <a href="event:groundZ+' .. i .. '">↑</a> <a href="event:groundZ-' .. i .. '">↓</a>\n' end end for nam in pairs(admins) do groundsStr = groundsStr .. "\n\n<p align='center'>" if #grounds > 8 then if startID > 8 then groundsStr = groundsStr .. string.format('<a href="event:groundSettings%d">< <font color="#c2c2da">%d-%d</font></a>', startID-8, startID-8, startID-1) end if #grounds > startID+8 then startID = startID+8 groundsStr = groundsStr .. string.format(' %s<a href="event:groundSettings%d">> <font color="#c2c2da">%d-%d</font></a>', startID > 8 and "<G>|<V> " or "", startID, startID, startID+7) end end end groundsStr = groundsStr .. "\n<V> Total: <N>" .. #grounds .. " <G>|<V> <R><b><a href='event:close'>Kapat</a> <G>|<V> <r><a href='event:printxml'>Print xml</b>" ui.addTextArea(45,"<p align='center'><J><font size='20'>Seçenekler toprak</font>\n\n<a href='event:groundAdd'>Ekle</a><p align='left'>\n\n"..groundsStr,name,300,50,200,317,1,0,0.8,true) elseif callback == 'groundAdd' then table.insert(grounds, { L=10, H=10, X=0, Y=0, T=0, P=string.split('0,0,0.3,0.2,0,0,0,0') }) eventTextAreaCallback(ID, name, 'groundSettings') elseif callback:sub(1,9) == 'groundDel' then local gID = tonumber(callback:sub(10) or 0) table.remove(grounds, gID) eventTextAreaCallback(ID, name, 'groundSettings') elseif callback:sub(1,10) == 'groundEdit' then local gID = tonumber(callback:sub(11)) -- zemin id if grounds[gID] then for nam in pairs(admins) do ui.addTextArea(121,"",name,grounds[gID].X-5,grounds[gID].Y-5,10,10,0xe9c764,0xe9c764,0.5,true) end ui.removeTextArea(45, name) for nam in pairs(admins) do ui.addTextArea(71,string.format("<p align='center'><b><font color='#BABD2F'>Zemin değiştirmek için bu seçeneklerden birine tıklayın</font></b><br><N><a href='event:changeValue%itype'>Type: %s</a> </font><G>|<N> <a href='event:changeValue%ix'>X: %i</a> <G>|<N> <a href='event:changeValue%iy'>Y: %i</a> <G>|<N> Z: %i <G>|<N> <a href='event:changeValue%il'>Uzunluk: %i</a> <G>|<N> <a href='event:changeValue%ih'>Yukseklik: %i</a> <G>|<N> <a href='event:changeValue%ifri'>Sürtünme: %s</a> <G>|<N> <a href='event:changeValue%ires'>Zemn Kavrm: %s</a> <G>|<N> <a href='event:changeValue%iangle'>Açı: %i</a> <G>|<N> <a href='event:changeValue%icolor'>Renk: %s</a><br><R><b><p align='left'><a href='event:close'>[Kapat]</a>", gID, groundTypes[tonumber(grounds[gID].T or 0)] or 'Unknown', gID, grounds[gID].X or 0, gID, grounds[gID].Y or 0, gID, gID, grounds[gID].L or 0, gID, grounds[gID].H or 0, gID, grounds[gID].P[3] or 0, gID, grounds[gID].P[4] or 0, gID, grounds[gID].P[5] or 0, gID, string.format('%x',grounds[gID].o or '0')),nam,40,50,720,nil,1,0,0.8) end else eventTextAreaCallback(ID, name, 'groundSettings') end elseif callback:sub(1,11) == 'changeValue' and callback:len() > 11 then local gID, editType = callback:match('changeValue(%d+)(.+)') if gID and editType then players[name].edit = { type=editType, ID=tonumber(gID) } ui.addPopup(53,2,"Yeni bir değer girin",name,300,105,200) print(name.." - "..editType) end elseif callback:sub(1,7) == 'groundZ' then local o, gID = callback:match('groundZ([%+%-])(%d+)') gID = gID and tonumber(gID) or 0 if grounds[gID] and #grounds > 1 then if o == '+' then table.swap(grounds, gID, gID == 1 and #grounds or gID-1) elseif o == '-' then table.swap(grounds, gID, gID == #grounds and 1 or gID+1) end eventTextAreaCallback(ID, name, 'groundSettings') end elseif callback == 'reloadMap' then updateXML() tfm.exec.newGame(xml) end end main() |
![]() ![]() « Censeur » 1527797040000
| 0 | ||
Thanks Muutluerkek ^^ |