Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - LUAnoob

Pages: [1]
1
Lua / Re: Error: Attempt to index local 'gc' (a nil value)
« on: February 01, 2012, 12:29:03 pm »
Well, got another problem.

I want, that wenn the function "drawArbeiten(gc)" is called and if I than press the key 1, that then not "menu=false", but "money = money + 10" happens (sry, don't know another word for it ;(). How can i realize it ?

2
Lua / Re: Error: Attempt to index local 'gc' (a nil value)
« on: February 01, 2012, 08:14:46 am »
Thank you, that helps me a lot.

3
Art / Re: Photoshop banners I did for SunkenServers
« on: February 01, 2012, 07:32:13 am »
I really like the third one. At the first one i didn't like that the font is curved (sry don't know another word for it, hope you know what i mean), but i love the background. The second one has a to simple background imo.

4
[DE] Andere TI- und Casio-Diskussionen / Re: My DoodleJump
« on: February 01, 2012, 06:53:14 am »
Gutes Spiel,

sieht gut aus, wie lange hast du dafür gebraucht ?

Grüße

5
[DE] Andere TI- und Casio-Diskussionen / Re: ASM-programmierer
« on: February 01, 2012, 06:51:40 am »
Asm programmieren tu ich nicht, bin aber deutsch ;D

6
Lua / Re: Error: Attempt to index local 'gc' (a nil value)
« on: February 01, 2012, 06:49:41 am »
In our school we have to buy it at the 8 grade (i'm living in Germany, but here are to few users which speak german, so i ask in english ;D I hope my sentences aren't so bad and you got no problem with it that my functions partly have german names :D)


I got another question now :)

I got this code:
Spoiler For Spoiler:
Code: [Select]
money=0
energy=100
fame=0
menu = true



function on.paint(gc)


if menu then
gc:setFont("sansserif","b",15)
gc:drawString("Pennergame",0,0,"top")
gc:setFont("sansserif","b",12)
gc:drawString("1.Arbeiten (Bringt Geld)",0,80,"top")
gc:drawString("2.Ausruhen (Bringt Energie)",0,100,"top")
gc:drawString("3.Sachen kaufen (Bringt Fame)",0,120,"top")
gc:setFont("sansserif","r",6)
gc:drawString("Money: "..tostring(money),250,0,"top")
gc:drawString("Energie: "..tostring(energy),250,10,"top")
gc:drawString("Fame: "..tostring(fame),250,20,"top")
gc:setFont("sansserif","b",8)
gc:drawString("(C)Tim Krase",0,200,"top")
end

if not menu then
drawArbeiten(gc)
end

end



function on.charIn(ch)
if ch=="1" then
menu=false

elseif ch=="2" then
elseif ch=="3" then
end
end

function drawArbeiten(gc)

gc:setFont("sansserif","b",15)
gc:drawString("1.Flaschensammeln",0,80,"top")
arbeiteneingabe(gc)

end


function arbeiteneingabe(ch)
if ch=="1" then
money = money + 10
fame = fame - 5
end
end

I got now "ch=="1"" but if i press the 1 at my TI, nothing happens :( But if i press the book sign (picture
Spoiler For Spoiler:


Uploaded with ImageShack.us
:) the function "drawArbeiten(gc)" is called.What code need i there if i want that the function "drawArbeiten(gc)" is called when i press 1 ? (By the way, it is "the function is called" or "the function was called?" sry for these questions, but i want to improve my "coding" english ;D)


7
Lua / Re: Error: Attempt to index local 'gc' (a nil value)
« on: January 31, 2012, 12:29:06 pm »
Thank you for your help. I've made it now with an true/false variable :) I will try your way and have a look which way is the best.

8
Lua / Re: Error: Attempt to index local 'gc' (a nil value)
« on: January 31, 2012, 11:58:41 am »
Thank you for your fast answer ;)
you have to pass gc from on.paint(gc)
What do you mean with "you have to pass gc from on.paint(gc)" ?
Can you give me a code example or explain it please ?
also dont expect too much fame and fortune, at least not for now. lol :)
how many poeple have an nSpire in your class anyway??
EDIT: also do you mean you are getting an error on line 40 too
Yes, i got an error at line 40 too, but i've corrected it.
All people in my class have an nSpire, because it was a demand of our teacher.

9
Great Work!  :thumbsup:

10
Lua / Error: Attempt to index local 'gc' (a nil value)
« on: January 31, 2012, 11:30:42 am »
Hey guys,

i got the problem, that i wanna made a game for me and my classmates, in which you can get money and fame :D

That's my source yet:


Spoiler For Spoiler:
Code: [Select]
money=0
energy=100
fame=0


function on.paint(gc)



gc:setFont("sansserif","b",15)
gc:drawString("Pennergame",0,0,"top")
gc:setFont("sansserif","b",12)
gc:drawString("1.Arbeiten (Bringt Geld)",0,80,"top")
gc:drawString("2.Ausruhen (Bringt Energie)",0,100,"top")
gc:drawString("3.Sachen kaufen (Bringt Fame)",0,120,"top")
gc:setFont("sansserif","r",6)
gc:drawString("Money: "..tostring(money),250,0,"top")
gc:drawString("Energie: "..tostring(energy),250,10,"top")
gc:drawString("Fame: "..tostring(fame),250,20,"top")
gc:setFont("sansserif","b",8)
gc:drawString("(C)Tim Krase",0,200,"top")




end

function on.charIn(ch)
if ch=="1" then
drawArbeiten(gc)
elseif ch==2 then
elseif ch==3 then


end
end

function drawArbeiten(gc)

gc:setFont("sansserif","b",15)
gc:drawString("1.Pflaschensammeln - 10",0,80,"top")

end

function arbeiteneingabe(ch)
if ch==1 then
money = money + 10
fame = fame - 5
end
end

And that's the error:

line 41: attempt to index local 'gc'(a nil value)

Line 41 is the line which "gc:setFont("sansserif","b",15)" includes.

Greetz,

LUAnoob


Pages: [1]