• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Setting integer variables with GUIJASS

Status
Not open for further replies.

Ardenian

A

Ardenian

Does it work as simple as I think ?

Example:
  • set udg_MainInteger = (udg_TestInteger + 1) + udg_LoopInteger
What do I use to mutliplicate, x or * ?

What about syntax ?
  • set udg_Integer1 = (udg_Integer1 + 1)/udg_Integer2
Would this be correct ?

Is it possible to add the GUIJASS
  • loop
into an integer calculation, without using the GUI loop, so you get value +1 for every loop ?
I would be great, since you could use the exitwhen adding conditions you could not add in GUI.
Or do I simply set a udg_Integer = udg_Integer +1 instead in the GUIJASS loop ?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
Yay, a GUIJASS user.

Anyway..

You use * to multiply and / to divide

You do not need a jass loop, really. I don't think it's worth it, you can do exitwhen in GUI.
edit:
  • For each (Integer my_int) from 1 to 10, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • my_int Equal to 6
        • Then - Actions
          • Set my_int = 10
          • -------- The loop will now be canceled --------
        • Else - Actions
 

Ardenian

A

Ardenian

Yay, a GUIJASS user.
Sarcasm ? I am soon changing to JASS, I think, since I already know most basics due to GUIJASS and using functions.

You use * to multiply and / to divide
Do I have to press the space somewhere, keeping a space between integers and mathematical signs like + and * ?

(udg_Integer + 1) / (5 * 9) or (udg_Integer+1)/(5*9) ?

Wow, that is actually a quite easy way to cancel the loop.

Thank you!
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
No sarcasm intended.

You can press as many spaces as you want. It wont affect anything, though I suggest using space for the sake of readablity.
(udg_Integer + 1) / (5 * 9) == correct

edit:
The problem with GUI loop is it is limited to 'for loops' so you have to use custom script lool endloop to make 'while loops'
Not exactly true, you can make while loops, though it's messy, I admit.
  • For each (Integer my_int) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set rng = (Random real number between 1.00 and 1000.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer(rng)) Not equal to 666
        • Then - Actions
          • Set my_int = 1
          • -------- The loop will now be canceled --------
        • Else - Actions
          • Set my_int = 10
This loop will repeat until the number 666 has been generated.
 

Ardenian

A

Ardenian

Chaosy said:
It wont affect anything, though I suggest using space for the sake of readablity.
Yeah, once some time ago I wondered why a trigger refused to work and had too many spaces in a custom script.

Thank you once again!
Flux said:
Or Custom Script: exitwhen true
to immediately end the loop
A GUI loop or a GUIJASS loop ?

Some time ago I wondered how I can check for != null, for example, if I check for every unit in a loop increasing range around a unit, exit loop once Picked Unit != null, but it refused to work appropriate ( might had other reasons, too).
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
A GUI loop or a GUIJASS loop ?

Some time ago I wondered how I can check for != null, for example, if I check for every unit in a loop increasing range around a unit, exit loop once Picked Unit != null, but it refused to work appropriate ( might had other reasons, too).

Either.

You can still make it in GUI.
If Condition To End loop Equals True then
Custom script: exitwhen true
Else

But come to think of it, I have you seen a GUI action
'While Condition"/
I think I saw one, not sure. If there is one, then GUI have a while loop after all.
 

Ardenian

A

Ardenian

Wow, exitwhen true is quite handy then, thank you very much!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
Integer operators obey BODMAS to some extent. Hence...
set udg_MainInteger = (udg_TestInteger + 1) + udg_LoopInteger
Can be written as...
set udg_MainInteger = udg_TestInteger + 1 + udg_LoopInteger
For the most part JASS works like most programming languages with a few language quirks (exitwhen statement, block declarations etc) and bugs (reference counter leak with local declared local handle variables).
 
Either.

You can still make it in GUI.
If Condition To End loop Equals True then
Custom script: exitwhen true
Else

But come to think of it, I have you seen a GUI action
'While Condition"/
I think I saw one, not sure. If there is one, then GUI have a while loop after all.

There is only a Wait for Condition which sleeps the thread until the condition is met, but there is no way to customize that loop so it's no what you're looking for.
 
Status
Not open for further replies.
Top