Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems problems problems
#1
I am new to programing. And when I try to do this

Code:
PRINT "setcvar "g_obj_alliedtext1" "Stalingrad" "
I keep getting an error. Its absoultly nesseray that the text looks like this
Code:
setcvar "g_obj_alliedtext1" "Stalingrad"
But I dont know how to do it with QBASIC.
Here is my code so far.

Code:
CLS
INPUT "What is your map name"; MapName$
INPUT "What is your name"; YourName$
INPUT "1)Allied Text:", AT1$
INPUT "2)Allied Text:", AT2$
INPUT "3)Allied Text:", AT3$
INPUT "1)German Text:", GT1$
INPUT "1)German Text:", GT2$
INPUT "1)German Text:", GT3$
INPUT "Score Board Pick name:", SBP$
PRINT
PRINT
PRINT ".......Proccesing........"
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT "Copy the SCRIPT below and call it"
PRINT "[YOURMAPNAME.SCR]  You dont need the []"
PRINT
PRINT
PRINT
PRINT
PRINT "//", MapName$
PRINT "//Map by ", YourName$
PRINT "//Scripting by Yarik"
PRINT "Main:"
PRINT
PRINT "// set score board messages"

After the last print this command
Code:
PRINT "setcvar "g_obj_alliedtext1" "Stalingrad" "
Keeps giving me errors. What should I do?
Reply
#2
The problem is that QB gets puzzled with the first " in your text, as it understands that the string you want to print has ended.

To print quotes you need to use the CHR$ function which takes an ASCII number and returns the correspondent character. The quote is at 34, so you can use both

Code:
PRINT "setcvar " + CHR$(34) + "g_obj_alliedtext1" + CHR$(34) + " " + CHR$(34) + "Stalingrad" + CHR$(34) + " "

or

Code:
PRINT "setcvar "; CHR$(34); "g_obj_alliedtext1"; CHR$(34); " "; CHR$(34); "Stalingrad"; CHR$(34); " "

Check QB help for PRINT and CHR$ to understand the command syntax.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
Quote:Check QB help for PRINT and CHR$ to understand the command syntax
Can you zip it up and send it to me? I dont have the help file.
Reply
#4
It now says Subscript out of range. And I tried your first option.

.....

Ok at the top of the script they have an option for allied text.

So I want it to print

setcvar "g_obj_alliedtext1" "Stalingrad"

But instead of stalingrad I want the input for the text that they did
So something like this

setcvar "g_obj_alliedtext1" "AT1$"
So what ever they typed in for AT1$ it will give them there name.
Reply
#5
You don't enclose variable names in quotes in QBasic. There is no escape handling. This is what you do:

Code:
PRINT "setcvar " + CHR$(34) + "g_obj_alliedtext1" + CHR$(34) + " " + CHR$(34) + "Stalingrad" + CHR$(34) + " " + AT1$

If I am understanding the question right...
Reply
#6
if you dont have the help files take a gander at that "qboho" link up top Smile
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#7
Subscript out of range? I tried the code before sending it to you, and it just prints this text on screen:

Code:
setcvar "g_obj_alliedtext1" "Stalingrad"

so it just works fine :???:
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)