Set an integer to a random integer?

Wratox1

Member
Reaction score
22
Hi, i need some help with integers;

I want to set an integer to the value of a random selected integer multiplied by the value of another random selected integer...

Is there anyway to do this?(im not good at jass, so id rather have it in GUI)And this even possible? i cant manage to figure it out:banghead:
 

Komaqtion

You can change this now in User CP.
Reaction score
469
You mean like this ?
Trigger:
  • Random Integer
    • Events
    • Conditions
    • Actions
      • Set Integer[1] = (Random integer number between 1 and 100)
      • Set Integer[2] = (Random integer number between 1 and 100)
      • Set Integer[2] = (Integer[1] * Integer[2])
 

Romek

Super Moderator
Reaction score
964
Trigger:
  • Set SomeInt = ((Random integer number between A and B) x (Random integer number between C and D))
 

Wratox1

Member
Reaction score
22
okay, maybe i wasnt really clear, i want to set a integervariable to a random integervariable multiplied by another random integervariable, or im just stupid and didnt see the answer among your posts...
 

Romek

Super Moderator
Reaction score
964
> Yeah, that's what i did in my post
Well, you just changed it from a division to a multiplication.
And your solution is still quite silly.

Amfie made a little mistake with the operation in #2 - My post is exactly his, with a different operation.

> or im just stupid and didnt see the answer among your posts...
:p
 

Tyrulan

Ultra Cool Member
Reaction score
37
Looks like you've got this one answered. He should be able to figure it out from here.


On a side note: Romek is using "Arithmetic" for his trigger.
(For the Asker)
 

Sajberhippie

New Member
Reaction score
30
No, I think he means something different.
@OP: Is your need to multiply a randomly selected already set integer variable among many integer variables with another of those?
And may I ask why in that case? The only way I could think of that is (quite) dynamic would be to have all the different integers that you choose between not to be different variables but arrays in a single variable and select Variable[random number between 1 and X].
 

Wratox1

Member
Reaction score
22
sajberhippie thats what im looking for ill explain some more and also show my triggers...

Trigger:
  • FirstClueKnights
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set FirstClue5 = (Random integer number between 1 and 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue5 Equal to 1
        • Then - Actions
          • Set RandomPoint = (Random point in FirstClue <gen>)
          • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_RandomPoint)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FirstClue5 Equal to 2
            • Then - Actions
              • Set RandomPoint = (Random point in FirstClue <gen>)
              • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_RandomPoint)
              • Set RandomPoint = (Random point in FirstClue <gen>)
              • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_RandomPoint)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FirstClue5 Equal to 3
                • Then - Actions
                  • Set RandomPoint = (Random point in FirstClue <gen>)
                  • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                  • Custom script: call RemoveLocation(udg_RandomPoint)
                  • Set RandomPoint = (Random point in FirstClue <gen>)
                  • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                  • Custom script: call RemoveLocation(udg_RandomPoint)
                  • Set RandomPoint = (Random point in FirstClue <gen>)
                  • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                  • Custom script: call RemoveLocation(udg_RandomPoint)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • FirstClue5 Equal to 4
                    • Then - Actions
                      • Set RandomPoint = (Random point in FirstClue <gen>)
                      • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                      • Custom script: call RemoveLocation(udg_RandomPoint)
                      • Set RandomPoint = (Random point in FirstClue <gen>)
                      • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                      • Custom script: call RemoveLocation(udg_RandomPoint)
                      • Set RandomPoint = (Random point in FirstClue <gen>)
                      • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                      • Custom script: call RemoveLocation(udg_RandomPoint)
                      • Set RandomPoint = (Random point in FirstClue <gen>)
                      • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                      • Custom script: call RemoveLocation(udg_RandomPoint)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • FirstClue5 Equal to 5
                        • Then - Actions
                          • Set RandomPoint = (Random point in FirstClue <gen>)
                          • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                          • Custom script: call RemoveLocation(udg_RandomPoint)
                          • Set RandomPoint = (Random point in FirstClue <gen>)
                          • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                          • Custom script: call RemoveLocation(udg_RandomPoint)
                          • Set RandomPoint = (Random point in FirstClue <gen>)
                          • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                          • Custom script: call RemoveLocation(udg_RandomPoint)
                          • Set RandomPoint = (Random point in FirstClue <gen>)
                          • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                          • Custom script: call RemoveLocation(udg_RandomPoint)
                          • Set RandomPoint = (Random point in FirstClue <gen>)
                          • Unit - Create 1 FakeUnit3 for Neutral Passive at RandomPoint facing Default building facing degrees
                          • Custom script: call RemoveLocation(udg_RandomPoint)
                        • Else - Actions


thats one of them, i have 4 just like this one, but a little longer... so i'll only show the shortest because one has random integer number between 1 and 30, its quite long...

then i have this one:
Trigger:
  • FirstClue
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set FirstClue = (FirstClue1 x FirstClue2)
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: Hi and welcome, tod...
      • Wait 6.00 seconds
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across FirstClue <gen>
      • Set Visibility = (Last created visibility modifier)
      • Game - Display to (All players) the text: Lets start with som...
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 600.00 seconds
      • Wait 1.50 seconds
      • Floating Text - Create floating text that reads Multiply the number... at (Center of FirstClue <gen>) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set Floatingtext = (Last created floating text)
      • Wait 10.00 seconds
      • Game - Display to (All players) the text: And when you think ...

and its in this trigger i want to change one thing;
Trigger:
  • Set FirstClue = (FirstClue1 x FirstClue2)

to something like: set FirstClue = (random integervariable x random integervariable)
which means that i want the trigger to set FirstClue to a random picked integervariable of the ones which exists and multipy the value of the picked integer with another random picked variable...

Am i getting my message clear?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Then you'll probably have to use arrays, and then you can use Random Number between x and y, meaning the lowest array value and the highest.
 

Tyrulan

Ultra Cool Member
Reaction score
37
What's wrong with this?:

Trigger:
  • Set FirstClue = ((Random integer number between 1 and 10) x (Random integer number between 1 and 10))


Or this...

Trigger:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set FirstClue = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue == 1
        • Then - Actions
          • Set temp_Number = Random Integer Variable 1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue == 2
        • Then - Actions
          • Set temp_Number = Random Integer Variable 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue == 3
        • Then - Actions
          • Set temp_Number = Random Integer Variable 3
        • Else - Actions


Arrays are much easier ... lol
 

Wratox1

Member
Reaction score
22
What's wrong with this?:

Trigger:
  • Set FirstClue = ((Random integer number between 1 and 10) x (Random integer number between 1 and 10))


Or this...

Trigger:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set FirstClue = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue == 1
        • Then - Actions
          • Set temp_Number = Random Integer Variable 1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue == 2
        • Then - Actions
          • Set temp_Number = Random Integer Variable 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FirstClue == 3
        • Then - Actions
          • Set temp_Number = Random Integer Variable 3
        • Else - Actions


Arrays are much easier ... lol

i don't think that you know what i want... take a look at post #10 and there is what i want...

as for the arrays, i was just curious about if there where any other way than arrays, even if i'm going to use arrays...

Quote:
Originally Posted by Wratox1
*awful code*



Egads! Use a for loop!


Code:
for i = 1 to FirstClue5
pick random point
create 1 unit at random point

how do you mean? do you mean a for each integer loop?
 

Tyrulan

Ultra Cool Member
Reaction score
37
Done trying to solve this problem for you. You're going to have to find a better way of explaining it to me without throwing triggers at me.
 

Wratox1

Member
Reaction score
22
well, the problem is solved, but i just wondered if there where any other methods to solve the problem, both easier and harder, just wanted to know what options i had... But anyway im gonna use arrays...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top