Jump to content

[Scripting] show debug notifications for RandomInt rolls how?


Nymra

Recommended Posts

Posted

Hey,
I want to add a 

 

Debug.Notification("your text here")

 

for the outcome of the following Random Int:

 

If Success || Utility.RandomInt(1,100) <= cfgqst.DefeatEscapeDiff

 

Meaning I want to see in the upper left corner if the value was 1 or 10 or 83 but I did not find any clue on how to do that and no mod that I can copy from :(

"You rolled a 23" 

 

thank you so much! 

Posted
2 minutes ago, Nymra said:

Hey,
I want to add a 

 

Debug.Notification("your text here")

 

for the outcome of the following Random Int:

 

If Success || Utility.RandomInt(1,100) <= cfgqst.DefeatEscapeDiff

 

Meaning I want to see in the upper left corner if the value was 1 or 10 or 83 but I did not find any clue on how to do that and no mod that I can copy from :(

"You rolled a 23" 

 

thank you so much! 

 

Like this, you mean?

 

Int iRandom = Utility.RandomInt(1,100)
Debug.Notification("You rolled a " + iRandom)

Posted
1 hour ago, orgs1n said:

 

Like this, you mean?

 

Int iRandom = Utility.RandomInt(1,100)
Debug.Notification("You rolled a " + iRandom)

 

 

hmm, this just returns "false".

Guess the code is a bit too complex for me lol

what I dont understand it why it only returns "false" even when I am successful (rolling low enough to escape). Ah damn. 

But well it seems to work like this, was just curious to see how the D100  throws its numbers. 
 

Bool Success = false
Bool Free = false	
bool bLocked = false	
Bool iRandom	

	If Success || Utility.RandomInt(1,100) <= cfgqst.DefeatEscapeDiff
		Debug.Notification("You rolled a " + iRandom)			;NYMRA DEBUG
        Debug.Notification("Your bindings finally feel loose... ") ;V02 move message up
    	Success = true 
		Free = true 
		libs.SexLabMoan(player)
		Utility.Wait(2)
        libs.SexLabMoan(player)
		Utility.Wait(1)
		libs.SexLabMoan(player)
		Debug.Notification("You can easily remove them now... (press jump one last time)")
    else
		Debug.Notification("You try to loosen your bindings... ")
		Debug.Notification("You rolled a " + iRandom)			;NYMRA DEBUG
		Utility.Wait(2)
		Debug.Notification("The device punishes you... ")
        Int i = 2

        while i
            i -= 1

            player.DamageActorValue("Stamina", damage)

            Int j = 3

            while j
                j -= 1

                Utility.Wait(2)
				cfgqst.ShockSpell.RemoteCast(libs.PlayerRef, libs.PlayerRef, libs.PlayerRef)	;WORKING ONLY EFFECT
				cfgqst.SoundSpell.RemoteCast(libs.PlayerRef, libs.PlayerRef, libs.PlayerRef)	;test
                libs.SexLabMoan(player)
				MfgConsoleFunc.SetPhoneme(libs.PlayerRef, 1, 100)

				
				
            endwhile
        endwhile

        Debug.Notification("Your bindings are too strong, try again... ")
    endif

    bLocked = false
EndEvent

 

Posted
17 minutes ago, Nymra said:

hmm, this just returns "false".

Guess the code is a bit too complex for me lol

what I dont understand it why it only returns "false" even when I am successful (rolling low enough to escape). Ah damn. 

But well it seems to work like this, was just curious to see how the D100  throws its numbers. 

 

Bool iRandom means you declare a variable of the type "boolean", so it can contain only True or False.

My example had it as int iRandom, meaning a variable of the type "integer", which can contain any integer value.

 

Moreover, your code doesn't assign any value to the iRandom variable. It just declares it, and prints it. So you would indeed see "False", because that's the default value of a boolean variable. (Meaning the value it gets after it's declared and before it is assigned a value.)

 

You should do something like this:

 

int iRandom = Utility.RandomInt(1,100)

If iRandom <= cfgqst.DefeatEscapeDiff

   Debug.Notification("You rolled a " + iRandom)

 

The first line declares a variable named "iRandom" of type integer, and rolls a random value, and assigns it to the variable.

The second line checks if the random value is lower than some difficulty threshold.

The third line prints the random value in a notification.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...