hoi hoi mensen ik ben net nieuw hier en heb me eigelijk geregristreerd voor dit probleempje
ik ben een Beginner in VBS maar ben het langzamerhand aan het leren vandaar dat jullie mischien zullen opkijken van mijn manier van programmeren.
maar iedergeval ik had een probleempje
ik ben dus een beetje aan het testen wat je kan met VBS en ben een game aan het maken maar hier in zit een fout
het is geen run-time error maar een fout in het spel zelf.
je begint in de "commandbar".
daar typ je "casino"
daarin typ je "gamble"
en dan kan je dus gokken. je geeft een getal op en dan hoort hij een getal tussen te 10 en de 1 aan te geven en dan "!! Hoort hij !! " als het getal gelijk is aan te geven dat je gewonnen hebt maar wat er ook gebeurt hij geeft altijd aan dat je verloren hebt.
ik heb geen iedee hoe ik het script zo kan krijgen dat als ik het goede getal geraden heb hij mij ook al winaar aan geeft.
kan iemand mij helpen.
Dit is het stukje script waar het om gaat
en daar onder zet ik het gehele script
om dit stukje hier beneden gaat het dus
ik ben een Beginner in VBS maar ben het langzamerhand aan het leren vandaar dat jullie mischien zullen opkijken van mijn manier van programmeren.
maar iedergeval ik had een probleempje
ik ben dus een beetje aan het testen wat je kan met VBS en ben een game aan het maken maar hier in zit een fout
het is geen run-time error maar een fout in het spel zelf.
je begint in de "commandbar".
daar typ je "casino"
daarin typ je "gamble"
en dan kan je dus gokken. je geeft een getal op en dan hoort hij een getal tussen te 10 en de 1 aan te geven en dan "!! Hoort hij !! " als het getal gelijk is aan te geven dat je gewonnen hebt maar wat er ook gebeurt hij geeft altijd aan dat je verloren hebt.
ik heb geen iedee hoe ik het script zo kan krijgen dat als ik het goede getal geraden heb hij mij ook al winaar aan geeft.
kan iemand mij helpen.
Dit is het stukje script waar het om gaat
en daar onder zet ik het gehele script
Code:
DIM money,exp,bullits,life,card
money=100
exp=0
bullits=0
card=3
turns=0
AD=empty
life=100
SUB commandbar
Do
DO
AD=inputbox("Commandbar: Typ help voor de commando's","commandbar")
Loop While AD=Empty
if AD="card status" THEN
Call CCstatus
end if
if AD="card cheat" THEN
Call CC
end if
IF AD="help" THEN
Call help
end if
IF AD="casino" THEN
Call casino
end if
IF AD="money status" THEN
Call MMstatus
end if
IF AD="driveby" THEN
call DB
end if
Loop until AD="end game" OR AD="exit game"
Call EX
End SUB
Call commandbar
SUB MMstatus
if AD="money status" THEN
MSGBOX"your money status is $"&money,0,"Money status"
call commandbar
end if
end sub
SUB CC
if AD="card cheat" THEN
turns=turns+1
if turns>=2 THEN
msgbox("Turns To High ,, Impossible to Increase CARDS"),0,"Error Increasing CARDS"
call commandbar
end if
IF turns<=2 THEN
card=card+1
MSGBOX("CARDS Increased BY +1 ,, This is a one time cheat"),0,"CARDS Cheat Sucsesfull"
call commandbar
end if
end if
end SUB
SUB CCstatus
if AD="card status" THEN
MSGBOX(" Card Status is ") &card ,0,"CARD STATUS"
Call commandbar
end if
end sub
SUB EX
if AD="end game" OR AD="exit game" THEN
AA=MSGBOX("Are you Sure To leave This game?",VBYesNo,"Exit game?")
if AA=VBYES THEN
MSGBOX("This Game Will be quited"),0,"Exit game? = YES "
wscript.quit
end if
IF AA=VBNO THEN
MSGBOX"This game will not be Quited",0,"Exit Game? = NO "
Call commandbar
end if
end if
end sub
SUB help
Dim strMsg,inp01,strTitle,strFlag
strTitle = "Help Commandbar"
strMsg = "This are the BASIC commands for the commandbar " & vbCR & vbCR
strMsg = strMsg & "'exit game' OR 'end game' = to quit the game" & vbCR & vbCR
strMsg = strMsg & "'card status' = to check the card status" & vbCR & vbCR
strMsg = strMsg & "'commandbar' to go to the commandbar" & vbCR & vbCR
strMsg = strMsg & "´back´ to go back to the commandbar " & vbCR & vbCR
strMsg = strMsg & "'cassino' To go to the casino " & vbCR & vbCR
strMsg = strMsg & "money status to check your money status" & vbCR & vbCR
strMsg = strMsg & "'driveby' is making a drive by and colect money" & vbCR & vbCR
strMsg = strMsg & "" & vbCR & vbCR
strMsg = strMsg & "" & vbCR & vbCR
strMsg = strMsg & "" & vbCR & vbCR
strFlag = False
Do While strFlag = False
inp01 = InputBox(strMsg,"Help Menu")
Select Case inp01
Case "terug"
MsgBox "u word door verwezen naar de commandbar!",0,strTitle
strFlag = True
Call commandbar
Case "commandbar"
MsgBox "u word door verwezen naar de commandbar!",0,strTitle
strFlag = True
Call commandbar
Case Else
MsgBox "You made an incorrect selection!",0,strTitle
End Select
Loop
end SUB
SUB DB
MSGBOX"You Are Going To Do A Drive By ,, 1 on 3 That it is Sucsesfull , This Costs 1 Card",0,"Drive By"
if life<20 THEN
MSGBOX"you are almost dead ,, you dont have enough life to make a drive-by, your life is "&life,0,"Error Doeing Drive-by"
end if
if life>20 THEN
if card<1 THEN
MSGBOX"You Dont Have Enough Card so you cant make a drive-by,, cards left: "&card,0,"Error Doeing Drive-by"
end if
IF card>1 THEN
XX=Int((3 * Rnd) + 1)
card=card-1
end if
IF XX=1 THEN
life=life-20
MSGBOX"Drive by Failed ,, the hitback was 20 of your life,, your life is now "&life,0,"Drive-by Failed"
end if
IF XX=3 THEN
life=life-20
MSGBOX"Drive by Failed ,, the hitback was 20 of your life,, your life is now "&life,0,"Drive-by Failed"
end if
IF XX=2 THEN
money=money+30
MSGBOX"Drive by compleet end sucsesfull ,, the hitback was 0 of your life,, you ownd &30 ,, your money is now $"&money,0,"Drive-by Failed"
end if
end if
Call commandbar
end sub
SUB casino
IF AD="casino" THEN
do
CA=inputbox("Input Your Casino Game ,, Games Are - gamble - turn - bit","Casino 1v.")
Loop While CA=empty
if CA="gamble" THEN
Call gamble
end if
if CA="exit game" OR CA="end game" THEN
Call EX
end if
if CA="commandbar" THEN
Call commandbar
end if
if CA="turn" THEN
Call turn
end if
end if
if not CA="commandbar" OR CA="end game" OR CA="exit game" THEN
call casino
end if
end SUB
Sub gamble
IF money<10 THEN
MSGBOX"You dont have enough money to play this game",0,"Error playing Gamble"
call casino
end if
if money>10 THEN
Do
GAMB=inputbox("Put in a Number between 1 and 5","GambleMaster says 'put in a number'")
Loop While GAMB=empty
If Not IsNumeric( GAMB ) Then
MSGBOX"You have not put in a right number",0,"The GambleMaster Says 'error'"
call gamble
end if
if GAMB<1 THEN
MSGBOX"You have not put in a right number",0,"The GambleMaster Says 'error'"
call gamble
end if
if GAMB>10 THEN
MSGBOX"You have not put in a right number",0,"The GambleMaster Says 'error'"
call gamble
end if
X=Int((10 * Rnd) + 1)
if not(GAMB=X) THEN
msgbox"You Have not won ,, the number was "&X,0,"We have A loser"
MSGBOX"You have lose $10 ",0,"lost"
money=money-10
end if
if (GAMB=X) THEN
msgbox"You Have won ,, the number was "&X,0,"We have A Winner"
MSGBOX"You have won $20 + $"&GAB,0,"Price"
money=money+20+GAB
money=money-10
end if
GABA=MSGBOX("Play Again?",VBYESNO,"Play Again?")
IF GABA=VBYES THEN
Call gamble
end if
if GABA=VBNO THEN
Call casino
end if
end if
end sub
SUB turn
MSGBOX"you are going to do Greater or lesser then the number 5 ,, This cost $20 you now got $"&money,0,"Greater > or Lesser < Then 5"
IF money<30 THEN
MSGBOX"You dont have enough money to play this game ,, you got $"&money,0,"Playtime Error"
Call casino
end if
if money>30 Then
GR=Inputbox("greater or lesser then the number 5? ","Turn ,, Greater or lesser? ")
IF GR="greater" THEN
money=money-20
XXX=Int((10 * Rnd) + 1)
if XXX>5 THEN
MSGBOX"We Got a Winner ,, you won $40 ,, the number was "&XXX,0,"You Won!!!"
money=money+40
end if
if XXX<5 THEN
MSGBOX"you lost your money ,, you lost $20 ,, the number was "&XXX,0,"You lost!!!"
money=money+0
end if
end if
IF GR="lesser" THEN
money=money-20
XXX=Int((10 * Rnd) + 1)
if XXX<5 THEN
MSGBOX"We Got a Winner ,, you won $40 ,, the number was "&XXX,0,"You Won!!!"
money=money+40
end if
if XXX>5 THEN
MSGBOX"you lost your money ,, you lost $20 ,, the number was "&XXX,0,"You lost!!!"
money=money+0
end if
end if
end if
end SUB
om dit stukje hier beneden gaat het dus
Code:
Sub gamble
IF money<10 THEN
MSGBOX"You dont have enough money to play this game",0,"Error playing Gamble"
call casino
end if
if money>10 THEN
Do
GAMB=inputbox("Put in a Number between 1 and 10","GambleMaster says 'put in a number'")
Loop While GAMB=empty
If Not IsNumeric( GAMB ) Then
MSGBOX"You have not put in a right number",0,"The GambleMaster Says 'error'"
call gamble
end if
if GAMB<1 THEN
MSGBOX"You have not put in a right number",0,"The GambleMaster Says 'error'"
call gamble
end if
if GAMB>10 THEN
MSGBOX"You have not put in a right number",0,"The GambleMaster Says 'error'"
call gamble
end if
X=Int((10 * Rnd) + 1)
if not(GAMB=X) THEN
msgbox"You Have not won ,, the number was "&X,0,"We have A loser"
MSGBOX"You have lose $10 ",0,"lost"
money=money-10
end if
if (GAMB=X) THEN
msgbox"You Have won ,, the number was "&X,0,"We have A Winner"
MSGBOX"You have won $20 + $"&GAB,0,"Price"
money=money+20+GAB
money=money-10
end if
GABA=MSGBOX("Play Again?",VBYESNO,"Play Again?")
IF GABA=VBYES THEN
Call gamble
end if
if GABA=VBNO THEN
Call casino
end if
end if
end sub
Laatst bewerkt: