DSLua Community
Welcome,
Guest
. Please
login
or
register
.
May 18, 2012, 09:37:26 PM
1371
Posts in
262
Topics by
33109
Members
Latest Member:
Limewire Download
Home
Help
Search
Login
Register
DSLua Community
|
DSLua - Best scripting language for Nintendo DS
|
Need Help?
|
Brennan's adventure game help topic.
« previous
next »
Pages:
[
1
]
2
Print
Author
Topic: Brennan's adventure game help topic. (Read 4915 times)
brennan
Waxing Crescent
Posts: 41
Brennan's adventure game help topic.
«
on:
September 16, 2006, 08:28:32 PM »
I'd rather not make a topic every time I have a question. So, this will be the permanant help topic for my upcoming text based adventure game.
First:
To use the Jeremysr's keyboard, does the LUA game file have to be in the same directory as all of the keyboard files?
Logged
Jeremysr
First Quarter
Posts: 215
Re: Brennan's adventure game help topic.
«
Reply #1 on:
September 16, 2006, 08:42:36 PM »
I guess it should work if you put it in a directory called "keyboard" and put at the top of your program:
require( "keyboard/keyboard.inc.lua" )
But I've tried something like that before and it didn't seem to work....maybe you need the CF version?
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #2 on:
September 16, 2006, 08:45:03 PM »
I'll try.
I just don't want to have to put all the keyboard files in the root.
I have the CF version.
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #3 on:
September 16, 2006, 10:39:41 PM »
I never thought I'd have to have to have help with this, but I can't get text to display.
Code:
-- set up screens
SCREEN_TOP = 1
BGTopText = Screen.LoadTextBG()
Screen.Initialize( SCREEN_TOP, BGTopText )
-- display start screen
BGTopText:PrintXY (9, 11, "Adventure Game" )
BGTopText:PrintXY (9, 12, "Press any key" )
DSLua.WaitForAnyKey()
BGTopText:Clear()
-- set up keyboard
require( "keyboard.inc.lua" )
require( "functions.inc.lua" )
-- game start
BGTopText: PrintXY (1, 24, "You are in a cave, there is a small candle")
BGTopText: PrintXY (1, 25, "to you left. What do you want to do?")
action = keyboard()
if action == take then
BGBotText:PrintXY (1, 27, "You took the candle!")
end
DSLua.WaitForAnyKey()
Text stops appearing on the top screen after I clear it up at the top (after the start screen)
I'm stumped.
(Also, I'm not sure if my "if" statement works, I haven't tested it.
Logged
Jeremysr
First Quarter
Posts: 215
Re: Brennan's adventure game help topic.
«
Reply #4 on:
September 16, 2006, 10:58:31 PM »
You're trying to print it at Y position 24, 25, and 27. It only goes from 0 to 23. (But X goes from 0 to 31.)
Also, when comparing things to strings, you put the string inside quotations marks unless it's a variable. So it should be: if action == "take" then
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #5 on:
September 16, 2006, 11:04:12 PM »
Thanks much, you're the man.
«
Last Edit: September 16, 2006, 11:08:01 PM by brennan
»
Logged
Jeremysr
First Quarter
Posts: 215
Re: Brennan's adventure game help topic.
«
Reply #6 on:
September 16, 2006, 11:32:09 PM »
I just finished writing a wordWrap() function. It's in Functions 1.6.
It'll prevent your te
xt from looking like th
is sentence.
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #7 on:
September 16, 2006, 11:38:16 PM »
Wow, I was just thinking about how how bad the text looks 'cause it's not wrapped.
You're a mindreader.
EDIT: Download link?
«
Last Edit: September 17, 2006, 12:09:17 AM by brennan
»
Logged
Jeremysr
First Quarter
Posts: 215
Re: Brennan's adventure game help topic.
«
Reply #8 on:
September 17, 2006, 12:26:06 AM »
It's here:
http://www.bio-gaming.com/jeremy/dslua/downloads/functions.zip
This is how you use it:
wordWrap( "The quick brown fox jumped over the lazy dog.", 1, 2, 3, SCREEN_TOP )
The first argument is the text be printed. The next two arguments are the X and Y positions to start printing on. The fourth one ("3" in the example) is the colour code (3 would be blue). And the last one is the screen to print it on, which can be 1 or 0. Also, you need your screen(s) to be called BGTopText or BGBotText for it to work.
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #9 on:
September 17, 2006, 01:11:47 AM »
I could put that in a function, and make it easier, like:
Code:
wrapText( "Wrapped text" )
Pretty easily, right?
Logged
Jeremysr
First Quarter
Posts: 215
Re: Brennan's adventure game help topic.
«
Reply #10 on:
September 17, 2006, 01:16:22 AM »
You have to put in all the arguments. I guess I should go to lua.org and learn how to make optional/default arguments but for now you have to put all of them.
Or you can go into functions.inc.lua and change it...
Oh, you mean something like this?
Code:
function wrapEasyText( txt )
wrapText( txt, 1, 1, 7, SCREEN_TOP )
end
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #11 on:
September 17, 2006, 01:21:23 AM »
Oh, yeah. I'll do that.
I thought I could
Code:
function wrapText( "(I'm not sure what I'd have to put here)" )
wordWrap( "The quick brown fox...", 1, 1, 7, SCREEN_TOP )
But I guess it would be easier to just change the .inc.lua ...
(We need a DSLua IRC channel for small chitchat like this :p)
Logged
Jeremysr
First Quarter
Posts: 215
Re: Brennan's adventure game help topic.
«
Reply #12 on:
September 17, 2006, 01:24:40 AM »
Yeah I guess you missed my edited post. I thought you meant something else.
And yes an IRC channel would be good.
Logged
brennan
Waxing Crescent
Posts: 41
Re: Brennan's adventure game help topic.
«
Reply #13 on:
September 17, 2006, 01:26:09 AM »
Oops, yeah, I missed the edit.
EDIT: Just added that function to the .inc.lua file, work just as wanted
«
Last Edit: September 17, 2006, 02:12:25 AM by brennan
»
Logged
jester
Waxing Crescent
Posts: 86
Jester Corp DS Logo
Re: Brennan's adventure game help topic.
«
Reply #14 on:
September 17, 2006, 02:42:25 PM »
can this also be a general help topic where every1's questions can be answered and code can be reviewed?
Logged
CURRENT PROJECT:
JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
Pages:
[
1
]
2
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
DSLua - Best scripting language for Nintendo DS
-----------------------------
=> News and Announcements
=> Examples/Tutorials
=> Home-brew/Hacks/Games/Projects
=> Hardware and Equipments
=> Need Help?
=> Bugs & Suggestions
-----------------------------
General DS Programming Chats
-----------------------------
=> Code Hashing
=> Chat Room
=> Test Area
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media