Banned
Join Date: Jul 2014
Location: Omaha, NE
Posts: 610
|
Just thought I'd give a quick update that I'm fixing any bugs I can find right now. Ain't easy cause there's a stupid crash somewhere the debugger isn't catching.
Anywho, players are now allowed to update and change server scripts.
Which includes code that allows you to update scripts such as the function:
server:updateScript("chat","this is the new chat script which won't run cause this isn't code, just text")
Scripts then send and update for all players.
I've added script collaboration to my "to-do" list so multiple players can script at the same time and see changes, much like in Google Docs.
After I figure out this random crash somewhere in my code, I'll be handing out Graal3D.exe or Graal3D.apk downloads to people who want to give the game a try with scripting.
Toodles
For fellow coders, here's the code to open a script and edit the contents:
OpenScript.lua
PHP Code:
if openScriptBackgroundID == nill then
openScriptBackgroundID = game_getNextID()
end
local openScriptBackground = CreateImage(openScriptBackgroundID,"GUIs/EditWindow.png",0,0,0,0)
openScriptBackground = CreateImage(openScriptBackgroundID,"GUIs/EditWindow.png",scaleToSize(640/2-openScriptBackground:getImageWidth()/2,640,window.width),scaleToSize(480/2-openScriptBackground:getImageHeight()/2,480,window.height),scaleToSize(openScriptBackground:getImageWidth(),640,window.width),scaleToSize(openScriptBackground:getImageHeight(),480,window.height))
openScriptBackground:setScaleImage(true)
if scriptEditBoxID == nill then
scriptEditBoxID = game_getNextID()
end
local scriptBox = CreateEditBox(scriptEditBoxID,scaleToSize(114+15,640,window.width),scaleToSize(52+40,480,window.height),scaleToSize(openScriptBackground:getImageWidth()-30,640,window.width),scaleToSize(openScriptBackground:getImageHeight()-100,480,window.height))
scriptBox:setMultiLine(true)
if runButtonID == nill then
runButtonID = game_getNextID()
end
local runButton = CreateButton(runButtonID,"Run",scaleToSize(114+14,640,window.width),scaleToSize(52+openScriptBackground:getImageHeight()-55,480,window.height),scaleToSize(openScriptBackground:getImageWidth()/2-19,640,window.width),scaleToSize(40,480,window.height))
if runButton:isPressed() then
server:updateScript(openNum,scriptBox:getText())
end
if openScriptCloseButtonID == nill then
openScriptCloseButtonID = game_getNextID()
end
local closeButton = CreateButton(openScriptCloseButtonID, "Close", scaleToSize(114+openScriptBackground:getImageWidth()/2+5,640,window.width),scaleToSize(52+openScriptBackground:getImageHeight()-55,480,window.height),scaleToSize(openScriptBackground:getImageWidth()/2-18,640,window.width),scaleToSize(40,480,window.height))
if scriptNameID == nill then
scriptNameID = game_getNextID()
end
local scriptName = CreateText(scriptNameID,"",scaleToSize(114+openScriptBackground:getImageWidth()/2-80,640,window.width),scaleToSize(52+4,480,window.height),scaleToSize(200,640,window.width),scaleToSize(40,480,window.height))
function openScriptFile(num)
openScript = true
viewScriptList = false
openNum = num
scriptBox:setText(getScript(num))
end
if openNum ~= nill then
scriptName:setText(scriptNames[openNum])
end
if closeButton:isPressed() then
openScript = false
viewScriptList = true
end
if openScript == false or openScript == nill then
runButton:setVisible(false)
openScriptBackground:setVisible(false)
scriptBox:setVisible(false)
scriptName:setVisible(false)
closeButton:setVisible(false)
else
game_removeControls()
menuButton:setVisible(false)
runButton:setVisible(true)
openScriptBackground:setVisible(true)
scriptBox:setVisible(true)
scriptName:setVisible(true)
closeButton:setVisible(true)
end
--End File - Required for Mobile Devices
Yes, yes, I know - Not the most efficiently written piece of code. Most of it I was coding while adding new functions
|