[Resolved] Edit Posts

Is there a way to edit a ‘Share your Code’ post? As I made a new Golem TextTyper version and I would like to update it. [import]uid: 147322 topic_id: 28182 reply_id: 328182[/import]

Due to the recent site issues we’re still ironing out I believe you cannot edit your post yourself - though you will be able to soon.

However in the meantime if you want something updated please provide a link to it and a clear description of what you would like edited and I’d be happy to make the change for you.

Peach :slight_smile: [import]uid: 52491 topic_id: 28182 reply_id: 113908[/import]

Here’s what I’d like edited:
Golem TextTyper

Here’s what I’d like it to be changed to: (just the code part, not the introduction)
Beginning of edit:

--Project: Golem TextTyper  
--  
--Author: CMP, Binc Games  
--  
--Version: 1.1  
--  
--Update History:  
-- Version 1.1:  
-- -Upgraded 'begin' function from 'continue', now only need to use 'begin' after suspending text  
-- -Added 'jumpToLetter' function  
-- -Added 'jumpToEnd' function  
--  
--There are no restrictions on this code. You can use it in whatever you want, however you want.  
--  
--If you happen to spot a bug, please tell at http://developer.anscamobile.com/code/golem-texttyper  
--  
--Golem.lua:  
  
local public={}  
  
function public.newTxt(message, spacing, txtFont, txtSize, txtColor)  
 if (type(message)=="string") then  
 local textTable = {}  
 local letters=0  
 local txtX=0  
 local lettersTyped=1  
 local txt=display.newGroup()  
 local txtSpeed=15  
 local spacing=spacing  
  
 if txtColor then  
 r=txtColor[1]  
 g=txtColor[2]  
 b=txtColor[3]  
 a=txtColor[4]  
 end  
  
 local function setMessage()  
 for i = 1, string.len(message) do  
 textTable[i] = message:sub(i,i)  
 letters=letters+1  
 for i = #textTable, #textTable do  
 table.insert(textTable, i, display.newText(textTable[i], 0, 0, txtFont, txtSize) )  
 textTable[i].x=txtX  
 if r and g and b then  
 textTable[i]:setTextColor(r, g, b)  
 if a then  
 textTable[i]:setTextColor(r, g, b, a)  
 end  
 end  
  
 txtX=txtX+spacing  
 txt:insert(textTable[i])  
 textTable[i].isVisible=false  
 end  
 end  
 end  
 setMessage()  
  
 local function typeText()  
 for i=lettersTyped, lettersTyped do  
 textTable[i].isVisible=true  
 lettersTyped=lettersTyped+1  
 end  
 end  
  
 function txt:setSpeed(modifiedSpeed)  
 txtSpeed=modifiedSpeed  
 if txt.txtTimer then  
 timer.cancel(txt.txtTimer)  
 end  
 end  
  
 function txt:begin()  
 if txt.txtTimer then  
 timer.cancel(txt.txtTimer)  
 end  
  
 local txtLeft=(letters-(lettersTyped-1))  
 txt.txtTimer=timer.performWithDelay ( txtSpeed, typeText, txtLeft)  
 end  
  
 function txt:suspend()  
 if txt.txtTimer then  
 timer.cancel(txt.txtTimer)  
 end  
 end  
  
 function txt:jumpToCharacter(txtNum)  
 if txt.txtTimer then  
 timer.cancel(txt.txtTimer)  
 end  
 if (txtNum and type(txtNum)=="number") then  
 for i=lettersTyped, txtNum do  
 textTable[i].isVisible=true  
 end   
 lettersTyped=txtNum  
 end  
 end  
  
 function txt:jumpToEnd()  
 if txt.txtTimer then  
 timer.cancel(txt.txtTimer)  
 end  
 for i=1, letters do  
 textTable[i].isVisible=true  
 end  
 lettersTyped=letters  
 end  
  
  
 return txt  
  
 end  
end  
return public  

You can also edit the usage example (from the end of the code) to:

local golem=require "golem"  
   
local myText=golem.newTxt("Hello, World!", 25, native.systemFont, 40) --specify the message, spacing, font, and size, each in that order  
myText:setSpeed(30) -- set the speed for each letter in milliseconds, defaults to 15  
myText:begin() -- begin typing text at specified speed  

To pause and resume:

myText:suspend()  
myText:begin()  

With the new update, you can also use the function ‘jumpToLetter’ and ‘jumpToEnd’:

myText:jumpToCharacter(5) -- text on screen is "Hello"  
myText:jumpToEnd() -- jumps to end of text  

End of edit

Thanks Peach!

binc

[import]uid: 147322 topic_id: 28182 reply_id: 113946[/import]

De nada - all done.

Peach :slight_smile: [import]uid: 52491 topic_id: 28182 reply_id: 114032[/import]

Thanks! I’ll let you know if I need to update it before I’m able to edit it myself. [import]uid: 147322 topic_id: 28182 reply_id: 114042[/import]

Just post in this thread again and I should get an email alert and will be happy to assist.

Peach :slight_smile: [import]uid: 52491 topic_id: 28182 reply_id: 114184[/import]

I can edit my posts now! Thanks so much for your help! If it gets removed or something, I’ll just tell you on this again. [import]uid: 147322 topic_id: 28182 reply_id: 114504[/import]

Yes, I believe the editing issue was resolved yesterday - it should be all good now.

As you said, simply bump if you encounter any other issues, though for now I shall mark this as resolved.

Peach :slight_smile: [import]uid: 52491 topic_id: 28182 reply_id: 114575[/import]