How do I create a random value ?

Get help using Construct 2

Post » Wed Sep 03, 2014 3:09 pm

how can i create a textbox that when i press " /roll x " it gives a value from 1 to x.

this textbox needs to be activated when "/" is pressed and after that i need to be able to type inside that box without clicking on it.

I need help on those above, even for the 1 of two at least if the other is impossible

thanks in advance !
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

Post » Wed Sep 03, 2014 4:35 pm

Create the textbox and in it's properties set enabled to no

keyboard on / pressed
- textbox set enabled
- textbox set focussed

i'm not sure what you mean by pressing " /roll x " so if you could explain that further?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 5:25 pm

He means a dice-roll like in mmo's
When you type in the textbox "/roll 100" and press enter, a random generatet number between 1 and 100 will be shown.
B
22
S
6
G
2
Posts: 185
Reputation: 3,632

Post » Wed Sep 03, 2014 5:37 pm

yes thats i mean Cherico ... like wow on chat when press : /roll1000 a random generated number between 1 to 1000 be shown.
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

Post » Wed Sep 03, 2014 5:53 pm

creating a random number isn't that hard just set the number to round(random(1,Number)) , where number is the number inputted by the player..

but if you want the roll part in front of it, before being able to use the number typed, you should remove that part of the text and only use the number after converting it back to an integer..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 6:28 pm

Can you send capx.? No is just a personal dice with out othet player can roll .is GM tool ... I dont want to create 1000 clobal and million event to do this..im looking for a simple way .. For one dice roll is easy between 1-20 when press roll20 iinside textbox show me a floor(random(1,20)) on text.. But if iwant to roll a diference number what we do???
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

Post » Wed Sep 03, 2014 6:55 pm

is it important that the player types roll?
are you planning to add other input possibilities?

Just asking, because If the player were just to enter a number it would be much easier..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 7:12 pm

ok sorry the player can enter a number.. my mistake cause in my game i have alot player's ..so you mean the player who play the game and no the player in game :PP . sorry i missunderstood what you mean player before
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

Post » Wed Sep 03, 2014 7:31 pm

These are the basics..
You do not have the required permissions to view the files attached to this post.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 03, 2014 8:13 pm

:) nice that's what i needed.. ty alot. cheers. :)
you save my day ;)
B
17
S
7
G
7
Posts: 205
Reputation: 5,335

Next

Return to How do I....?

Who is online

Users browsing this forum: Fradno, marcinkowski and 12 guests