Hi,
I was wondering if anyone knew which function I had to use to create a random integer between 1 and a certain number that I could define? Thank you.
Feel free to add me.
You are not logged in. Please login or register.
AudioGames.net Forum → Off-topic room → jaws scripting help, please?
Hi,
I was wondering if anyone knew which function I had to use to create a random integer between 1 and a certain number that I could define? Thank you.
Check for a "rand" or "random" function in the list, but if there isn't any "rand" or "random" function in Ctrl+I function list, it's probably impossible to do it in jaws script.
Howdy,
I need help on JAWS scripting, too. Since I am a newbie on JAWS scripting, you may find my following script so tedious. Anyway,let me tell my issue that I am currently having.
I attempted to write a script that will do an arithmetic operation, and present the result in a dialog box but what I got is a compilation error. Here is the script that I mentioned:
Script Test ()
VAR
int X,
int Y,
int Z
X=Y+Z
Y=155*120
Z=25
ExMessageBox ("The value that you are looking for is", SayInteger (Z), "FYI!", MB_OK)
EndScript
Where am I doing wrong? Any help would be greatly appreciated.
Regards,
SplendidFault
Where am I doing wrong? Any help would be greatly appreciated.
Hello,
Lets look at the issues one by one.
First compile error I get, "unknown variable mb_ok".
This is because the MB_Ok item is part of the FS standard libraries. You need to include them, usually at the top of your script file.
include "hjconst.jsh"
include "hjglobal.jsh"
Next error: " Function ExMessageBox requires 3 parameters not 4".
This is because you've got a comma in what should be the first parameter, you need to have the value that you are looking for, quote, pplus. Instead of quote then a comma.
next error: " Parameter 1 to Function ExMessageBox should be of type string not int"
This is because you are trying to use a say function within a message box. The say functions output text to the synthesizer. TO display a number inside a message box you need to use the IntToString function in place of SayInteger.
With the above changes, compilation succeeds. running the script, I get: "FYI! Dialog
The value that you are looking for is25
OKButton"
My complete code is below:
include "hjconst.jsh"
include "hjglobal.jsh"
Script Test ()
VAR
int X,
int Y,
int Z
X=Y+Z
Y=155*120
Z=25
ExMessageBox ("The value that you are looking for is"+ intToString(Z), "FYI!", MB_OK)
EndScript
Hello,
A very perfect explaination! Many thanks for this nice touch. Now, with your aid, this is the last version of my script. I added a space after 'is', and put a period sign just end of the sentence. It now gives the result in a more natural way. Compile and see:
include "HJConst.jsh"
include "HJGlobal.jsh"Script Test ()
VAR
int X,
int Y,
int Z
X=Y+Z
Y=155*120
Z=25
ExMessageBox ("The value that you are looking for is"+" "+IntToString (Z)+".", "Important Information!", MB_OK)
EndScript
Regards,
SplendidFault
that's perfect.
One thing to note is that x will -=0 in this script, because when you wrote X=Y+Z, Y and Z were both 0. you only changed their values after you assigned X.
If you need any further help, please ask; I am happy to oblige.
Let's see if I figured out your statement about necessity of assigning a value for X first:
Script Test ()
VAR
int X,
int Y,
int Z
X=15
Y=155*120
Z=25
let X=Y+Z
ExMessageBox ("The value that you are looking for is"+" "+IntToString (X)+".", "Important Information!", MB_OK)
EndScript
Sincerely yours,
SplendidFault
Let's see if I figured out your statement about necessity of assigning a value for X first
No, not quite correct.
In your first script, you wrote:
X=Y+Z
Y=155*120
Z=25
If you output these, Z=25, Y=18600, and X=0.
X=0 because, when you wrote X=Y+Z, Y and Z both=0.
if you move the lines, so you had:
Y=155*120
Z=25
X=Y+Z
X now =465000.
y, 18600, multiplied by (*) Z, 25).
I hope this helps explain.
Or to put it another way:
You set X equal to Y plus Z before you put anything into Y or Z. Think of it as like having a milk bottle, cereal container and bowl. You need to put milk in the bottle and cereal into the cereal box before you can use them to put anything into the bowl.
Nicely explained, thanks again. Now I feel like I should step into more complex scripting methods, like decision making, function calling etc.
JAWS scripting is a strange language. I'd advise not learning it, just to learn to program - there are languages more suited to that.
if you have an application to script, though, or you want to write a script as a JAWS plugin etc that might be a good way to start.
keep us posted!
AudioGames.net Forum → Off-topic room → jaws scripting help, please?
Generated in 0.029 seconds (37% PHP - 63% DB) with 9 queries