Scripting question

tiltjlp

PN co-founder
Joined
Jun 9, 2003
Messages
3,403
Reaction score
145
Points
65
Favorite Pinball Machine
Flying Trapeze 1934
My dim statements are below:

When I try to run the table, I get an error mesage on Dim 10H of "Expected Identifier" which is a first for me. Te table is a card theme, and the Dim statements from 10H on down track the cards for awarding of bonus points.

I've used this same sort of thing to track bonuses and such any number of times, and have always been able to debug the script, and probably could now except for this "Expected Identifier" thing which is a new one on me. Could one of you coding whizzes head me in the right direction? Thanks in advance, since I'm sure I'll get an answer.

dim ballcrea
ballcrea=0
dim balls
balls=10
dim score
score=0
Dim 10H
10H=0
Dim 10D
10D=0
Dim 10C
10C=0
Dim 10S
10S=0
Dim JH
JH=0
Dim JD
JD=0
Dim JC
JC=0
Dim JS
JS=0
Dim QH
QH=0
Dim QD
QD=0
Dim QC
QC=0
Dim QS
QS=0
Dim KH
KH=0
Dim KD
KD=0
Dim KC
KC=0
Dim KS
KS=0
Dim AH
AH=0
Dim AD
AD=0
Dim AC
AC=0
Dim AS
AS=0
Dim JK
JK=1
 
Probably because you have numbers first. H10 would not have that result

Also you could dim like this

Dim a,b,c,d,e.....

Also unless it is in a routine that resets the variables, like a game init, or reset then you can leave out all the equal zeros, if it is, then you should not re-Dim

'
Dim A,B,C,D

Game_Init()
A=0 : B=0 : C=0 : D=0 ...
'


This don't answer your question, but I hope it helps.
 
Shockman said:
Probably because you have numbers first. H10 would not have that result

Also you could dim like this

Dim a,b,c,d,e.....

Also unless it is in a routine that resets the veriables, like a game init, or reset then you can leave out all the equal zeros, if it is, then you should not re-Dim

'
Dim A,B,C,D

Game_Init()
A=0 : B=0 : C=0 : D=0 ...
'


This don't answer your question, but I hope it helps.

Yeah, the variables do get reset, and I know I can put all the Dim statements on one line, but my way makes it easier to make sure I have them all listed. I don't understand what you mean by re-dim. Like I said, I've used this exact same method dozens of times without any problem, except this time I got an Expected Identifier.

You did give me an idea about making 10H TenH. I'll check that out and see if it solves my problem.
 
Well Shockman, you were right about to 10 thing, Changing the 10s all to Ten fixed that problem, so I made changes to my AS too, which is probably a booleen factor. At least now I'm down to the standard Syntax errors, which I can eventually work out on my own. So thanks loads, you solved the mystery for me, in an around about way, and even taught me something in the process.
 
It might work, but it is very bad form to Dim more then needed, usually once. Time, no big deal, but if it is actually making room and resources, I don't know. Dim outside the structure, then set them inside it. Glad to help, a little, or a lot. That is what I'm here for. Besides getting the help I need.
 
You can also Dim in multiples, which will save a bit of typing, looks neater and is easier to debug for example.

Dim a,b,c,d,e,f,g,h,j,k,m,n,o,p,q,r,s,t,u,v,w,x,y,z

Also all variables/indentifiers must start with an alpha.

Dim a10203945

is OK

where as

Dim 2hfjgktn

Will always give you an error
 
Shockman said:

Oh, sorry about that Shockman, just got up still haven't had my first cup of coffee. :shock:
 
Well I'm back, still plugging away at what I suppose is booleen logic, ans till as confused as ever. I've debugged all four Royal Flush routines, and the 4Aces & 1 Joker routine, but am having a fit with the regular Flush routine. A Flush is 10, J, Q, K, and Ace in any combination of the 4 suits. where as a Royal Flush must be those same cards all of the same suit. Below are two failed attempt at scripting a Flush routine. Any help would be appreciated.


'Sub FlushCheck() 'checks for any flush
' if tenh=1 or tend=1 or tenc=1 or tens=1 and
' if Jh=1 or Jd=1 or Jc=1 or Js=1 and
' if Qh=1 or Qd=1 or Qc=1 or Qs=1 and
' if Kh=1 or Kd=1 or Kc=1 or Ks=1 and
' if AH=1 or Ad=1 or Ac=1 or ASp=1 then
' Addscore 7500
' else
' BallCheck
' end if
' end if
' end if
' end if
' End Sub

Sub FlushCheck()
if*Ten=1 and *J=1 and *Q=1 and *K=1 and *A=1 then
Addscore 7500
else
BallCheck
end if
End Sub
 
A stright is what you describe, not a flush, which is the all the same suit.

Still, that routine don't make a bit of sense.

Ending in and, I think it would be a bug in VB if it did not flag every line as an error.

I don't have any idea what you want. you want to call a stright a flush? Ok. But what are you going to check for, a stright of a flush?

IF you want to check the cards for a 10,J,K,Q,A in any suit then try

Sub FlushCheck() 'checks for any flush
If (tenh=1 Or tend=1 Or tenc=1 Or tens=1) And (Jh=1 Or Jd=1 Or Jc=1 Or Js=1) And (Kh=1 Or Kd=1 Or Kc=1 Or Ks=1) And (Qh=1 Or Qd=1 Or Qc=1 Or Qs=1) And (Ah=1 Or Ad=1 Or Ac=1 Or Asp=1) Then
AddScore 75000
Else
BallCheck
End If
End Sub

This checks for a High stright, and is a correct form of what you have.

How many cards are in the deck? You have to check for each and every one.

To check for a flush with just those 5 high cards, try

If (Ah=1 And Kh=1 And Qh=1 And Jh=1 And tenh=1) Or (Asp=1 And Ks=1 And Qs=1 And Js=1 And tens=1) Or (Ac=1 And Kc=1 And Qc=1 And Jc=1 And tenc=1) Or (Ah=1 And Kh=1 And Qh=1 And Jh=1 And tenh=1) Or (Ad=1 And Kd=1 And Qd=1 And Jd=1 And tend=1) Then
....
....
....


I'm surprised you have any hand working at all.


StevOz, you are a prick.
 
As is a key word in VB as most basic, c and such.
 
What is this crap about 'round about way' John? Don't try to make it some accident that I was able to answer your question. It was a direct answer. Nothing round about about it.
 
Shockman said:
What is this crap about 'round about way' John? Don't try to make it some accident that I was able to answer your question. It was a direct answer. Nothing round about about it.

No, the accident was that I sort of understood your answer. And thanks for your additional help. The fact that I called a Straight a Flush should tell you how long it's been since I played poker. Probably close to 30 years, and then I played so seldom I could never remember what hands were the best. As for this game, there are 21 cards, 10-A in all 4 suits and a Joker. I'm assuming my routines work since they aren't returning errors, although your all in one routiine surely is the best way to go. So thanks again.

BTW, what's your beef with Steve?
 
Steve Knows that starting a thread out of one of my posts is not going to make me happy. He in fact knows that it is going to make me very angry. You all know that my being banned at VPF was because of the way I reacted to that very thing happening. Steve is scum.
I told that ass licking bitch that he could do that, he could move such posts, but to Start the fucking thread with a post saying that he did that. If Jon does not fire him, or he does not change that REAL FAST then I am going to finally come undone.
I will probably end up writing a nasty message and quiting, or writing a nasty message and getting banned.
I don't care any more. I told him he could do that, but it's not the moving he wanted to do Jon, it's the thread made from my post. Did I call Steve scum, I'm sorry, scum.
 
'Sub FlushCheck() 'checks for any flush
' if tenh=1 or tend=1 or tenc=1 or tens=1 and
' if Jh=1 or Jd=1 or Jc=1 or Js=1 and
' if Qh=1 or Qd=1 or Qc=1 or Qs=1 and
' if Kh=1 or Kd=1 or Kc=1 or Ks=1 and
' if AH=1 or Ad=1 or Ac=1 or ASp=1 then
' Addscore 7500
' else
' BallCheck
' end if
' end if
' end if
' end if
' End Sub

That works? I thought you said it didn't. If the syntax works, then what was the problem with it?
 
Shockman said:
'Sub FlushCheck() 'checks for any flush
' if tenh=1 or tend=1 or tenc=1 or tens=1 and
' if Jh=1 or Jd=1 or Jc=1 or Js=1 and
' if Qh=1 or Qd=1 or Qc=1 or Qs=1 and
' if Kh=1 or Kd=1 or Kc=1 or Ks=1 and
' if AH=1 or Ad=1 or Ac=1 or ASp=1 then
' Addscore 7500
' else
' BallCheck
' end if
' end if
' end if
' end if
' End Sub

That works? I thought you said it didn't. If the syntax works, then what was the problem with it?

No, that doesn't work, it gives a syntax error. But your other routine, which I renamed StraightCheck gives an Out Of Stack error, and I have no idea what that means.

'Sub StraightCheck() 'checks for any straight
' If (tenh=1 Or tend=1 Or tenc=1 Or tens=1) And (Jh=1 Or Jd=1 Or Jc=1 Or Js=1) And (Kh=1 Or Kd=1 Or Kc=1 Or Ks=1) And (Qh=1 Or Qd=1 Or Qc=1 Or Qs=1) And (Ah=1 Or Ad=1 Or Ac=1 Or Asp=1) Then
' AddScore 75000
' Else
' AceCheck
' BallCheck
' End If
' End Sub

As far as your rant posts, what does it matter any more after 5 lousy years if posts are moved to a thread with your name on the thread or not? Nobody other than you cares any more, we all simply want you to FOCUS on pinball and forget this other stuff. It's nobody's fault but your own that you're still banned from VPF. If you would simply shut up about it and move one they would eventually unban you. And it would probably take a lot less time than you think.

Now if you continue as you have stated, and just maybe you do get banned here, what will you have achieved? You'll run out of VP forums sooner or later, and then what? The fatal flaw in your logic is that you don't get to dictate how any of the forums run, so you either have to Do things the forum's way or you're going to continue to be unhappy. In spite of how helpful you are, droaning on endlessly about somthing that started nearly 5 years ago simply make you a royal pain in the eyes of a lot of people.
 
I wish you were still part of the staff, because I think you would have taken care of that issue if that (what's worse than scum?) didn't by now. You might go tell on another site that it was a joke, but I would not care, it would still be done. And I don't believe you anyway. I think you saw the red flags in Peters post, the green and what I saw as white with a hint of check. Did you ever see a version without the edit mark anyway? I know you want as many people as possible to like you, but if anyone did not like me because I liked you, I'd say 'Ron, Bite me.' Just kidding. It would be different with you though, wouldn't it? How do you spell, nevermind I can't ask in writing.

I think StevOz is trying to make this into a nother VPF as far as rules for every little thing and make up more as you go along kinda thing, don't you?

As I said I don't agree with what he is doing, but I said that I would not bitch about that, if he would just start the thread with a post of his own. I said this at VPF. It was one of the last things I said. I did not start a thread with (Shockman vs VPF in this case) and I don't want it to look as I did.

It was sitting there waiting, that thread of his, with a post in it from him. He deleted it when he put my post in it so I would show as the authr. He probably wants to ban me. He would like to just do it outright, but he knows it won't fly, and knows that if he plays me right, he will get more backing.
 
Just got back from another forum, you really do talk out of both sides of your face, don't you. You must be about as spiritual as a house fly.
 
I'll be completely honest with you Phil. I'm so sick and tired of all your stuff about injustice that if this was my site you would be banned for spamming, if for no other reason. Jon doesn't want bans so we simply have to put up with you going on endlessly about stuff that is close to 5 years old. This latest deal with vpf isn't where it started, just the latest version. If nic and TMFP told you that they would unban you if you didn't post for 24 hours you'd argue that it should be 23 hours and 59 seconds. I'm convinced you either simply want attention or are serious disturbed.
 
5 years old? What did I say about anything 5 years old. If I did it was in response like here and now. If I said that it was wrong in this post you would say I was at it again. I challenge you to put up or shut up. You show me where I have brought up anything 5 , 4,3, 2, or even one year ago that was not in response to something that someone else had brought up. You do that and I will just leave for good, fail, and STFU about it, OK?
 
Hey, where did every one go all of a sudden? Oh there you are in the search engine.
 
sigh...

Trying to stay on the actual subject here, John, you think you have problems with scripting? I just got the VB 5 Express version from Microsoft, and I am just absolutely totally lost. I blame MS of course, but at least we have a editor for this, and a lot of the work is done for us.

I have to admire people that have taken the time to learn VB using VB5express, as it's totally complex and confusing. Of course, it would help if Micro$ofts BLOODY ONLINE HELP ACTUALLY WORKED! Grrrr...

Bill Gates is the spawn of the devil...
 
BTW John what table is this script for?

Do the cards have VP lights?

If so you should try use collections then you can create a collection for each result (royal flush, flush, striaght, three of a kind, pair).

Then test each collection.

For each light in royal

If light.state = 0 then exit sub

' royal flush complete, award royal flush

End Sub
 
Forum activity
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Mibs Mibs: HZR has posted a new reply in the thread "Complete list of VB commands".
      Back
      Top