Page 1 of 1

S'CUSE ME?

Posted: Mon Feb 06, 2017 4:09 pm
by BananaCat
OKay, this is not nice:

Code: Select all

local customData = Data(Data.DATA_WORLD, true)
customData:set("cardboardCoin",0)


function onTick()
	Text.print(customData:get("cardboardCoin"),0,0)
end

function onMessageBox(eventObj, msgStr)
	if msgStr == "mysteryToadTalk" then
		eventObj.cancelled = true
		Text.showMessageBox("Hey, I'm known as Russ T. in these parts, but I can lend you some useful information if you lend me a cardboard coin.")
		if customData:get("cardboardCoin") > 0 then
			Text.showMessageBox("Huh, you dont got any cardboard coins on you?")
			Text.showMessageBox("Well! We gotta teach you a lesson!")
			Text.showMessageBox("Cardboard coins are what makes the world go 'round! They seem useless, but they are worth a fortune!")
			Text.showMessageBox("There is five coins in each level, so they are easy money.")
			Text.showMessageBox("They respawn so its easy to farm as well!")
		end
		Text.showMessageBox("So maybe I could have one? (Press X to lend a cardboard coin)")
		if customData:get("cardboardCoin") == true then
			if customData:get("cardboardCoin") > 0 then
				customData:set("cardboardCoin",customData:get("cardboardCoin") - 1)
				Text.showMessageBox("Thank you!")
				-- here is supposed to be some code that tells different things after you progressively finish each level
			else
				Text.showMessageBox("Oh come on! Stop playing me, you dont have any cardboard coins!")
			end
		end
	end
end
So, the error is in line two (the debugger wasn't that helpful.) Anything?

Re: S'CUSE ME?

Posted: Mon Feb 06, 2017 4:37 pm
by Emral
I'd ask you to show me "the error" but I can already tell it's because the unencrypted data class only accepts strings. Change the 0 to a "0" or encrypt your data class.
In the future, please provide the error message, too. I'll be the judge of whether or not it's helpful.

Re: S'CUSE ME?

Posted: Mon Feb 06, 2017 4:41 pm
by BananaCat
Enjl wrote:I'd ask you to show me "the error" but I can already tell it's because the unencrypted data class only accepts strings. Change the 0 to a "0" or encrypt your data class.
In the future, please provide the error message, too. I'll be the judge of whether or not it's helpful.
I didnt actually get a error message, I got a debug message that said there was a error in line 2

Re: S'CUSE ME?

Posted: Mon Feb 06, 2017 5:01 pm
by Emral
That's what we call an error message.

Re: S'CUSE ME?

Posted: Mon Feb 06, 2017 6:39 pm
by Hoeloe
BananaCat wrote:
Enjl wrote:I'd ask you to show me "the error" but I can already tell it's because the unencrypted data class only accepts strings. Change the 0 to a "0" or encrypt your data class.
In the future, please provide the error message, too. I'll be the judge of whether or not it's helpful.
I didnt actually get a error message, I got a debug message that said there was a error in line 2
It will have also contained information relevant to the cause of the problem. You may not have understood it, but that does not mean it wasn't there.

Also Enjl is right, the Data class does not accept numbers, only strings.