• ✨ ARCHIVE MODE ✨
    The forum has now been set to read-only mode, no new posts, resources, replies etc will not be possible.
    We recommend you join our Discord server to get real-time response: Discord Invite Link

Fixed [Indev 0.53] Massive Math Problems

J

jianmingyong

Guest
Describe the bug you experienced here.

What I expected to happen:
The computer to be smarter than a human in doing math.

What actually happened:
Totally screwed up and I have no idea how to reproduce this. It work properly in v0.52.1 but now all fails.

Debug Logs:
Code:
Chat.vb: @Player.warp(15\test.dat)
Debug (21:44:57): 26000000+20 = 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 26
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 27000000+20 = 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 27
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 28000000+20 = 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 28
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 29000000+20 = 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 29
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 30000000+20 = 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 30
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 31000000+20 = 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 31
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 32000000+20 = 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 32
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 33000000+20 = 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 33
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 34000000+20 = 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 34
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 35000000+20 = 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 35
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 20
Debug (21:44:57): 26000000+21 = 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 26
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 27000000+21 = 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 27
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 28000000+21 = 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 28
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 29000000+21 = 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 29
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 30000000+21 = 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 30
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 31000000+21 = 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 31
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 32000000+21 = 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 32
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 33000000+21 = 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 33
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 34000000+21 = 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 34
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 35000000+21 = 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 35
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 21
Debug (21:44:57): 26000000+22 = 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 26
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 27000000+22 = 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 27
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 28000000+22 = 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 28
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 29000000+22 = 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 29
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 30000000+22 = 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 30
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 31000000+22 = 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 31
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 32000000+22 = 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 32
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 33000000+22 = 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 33
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 34000000+22 = 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 34
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 35000000+22 = 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 35
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 22
Debug (21:44:57): 26000000+23 = 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 26
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 27000000+23 = 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 27
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 28000000+23 = 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 28
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 29000000+23 = 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 29
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 30000000+23 = 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 30
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 31000000+23 = 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 31
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 32000000+23 = 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 32
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 33000000+23 = 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 33
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 34000000+23 = 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 34
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 35000000+23 = 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 35
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 23
Debug (21:44:57): 26000000+24 = 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 26000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 26
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 27000000+24 = 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 27000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 27
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 28000000+24 = 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 28000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 28
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 29000000+24 = 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 29000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 29
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 30000000+24 = 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 30000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 30
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 31000000+24 = 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 31000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 31
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 32000000+24 = 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 32000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 32
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 33000000+24 = 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 33000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 33
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 34000000+24 = 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 34000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 34
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
Debug (21:44:57): 35000000+24 = 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomID.1: 35000020
Debug (21:44:57): MysteryDungeon.CurrentDigRoomX: 35
Debug (21:44:57): MysteryDungeon.CurrentDigRoomZ: 24
A Debug Script:
Code:
version=2
# This is a API for Random Dungeon Generator.
# You will require a compatible map to run this.

##############################
# Main Settings
##############################

# Define Map Size.
@Storage.set(int,MysteryDungeon.MapSizeX,50)
@Storage.set(int,MysteryDungeon.MapSizeZ,50)

# Define Room Size.
# By default, Min Room Size is 5 by 5.
@Storage.set(int,MysteryDungeon.MaxRoomSizeX,10)
@Storage.set(int,MysteryDungeon.MaxRoomSizeZ,10)

# Define Number of Tiles to be Removed at the same time.
# The bigger the value, the faster it process.
# Max value is 10.
@Storage.set(int,MysteryDungeon.Processor,1)

##############################
# Do not touch anything below here
##############################
# Init Variable.
@Storage.set(int,MysteryDungeon.NumberOfRoomGenerated,0)
@Storage.set(int,MysteryDungeon.Processor,<Math.clamp(<Storage.get(int,MysteryDungeon.Processor)>,1,10)>)
@Storage.set(int,MysteryDungeon.MaxRoomSizeX,<Math.clamp(<Storage.get(int,MysteryDungeon.MaxRoomSizeX)>,5,<Storage.get(int,MysteryDungeon.MapSizeX)>-1)>)
@Storage.set(int,MysteryDungeon.MaxRoomSizeZ,<Math.clamp(<Storage.get(int,MysteryDungeon.MaxRoomSizeZ)>,5,<Storage.get(int,MysteryDungeon.MapSizeZ)>-1)>)

@Storage.set(int,MysteryDungeon.RoomSizeX,<System.random(5,<Storage.get(int,MysteryDungeon.MaxRoomSizeX)>)>)
@Storage.set(int,MysteryDungeon.RoomSizeZ,<System.random(5,<Storage.get(int,MysteryDungeon.MaxRoomSizeZ)>)>)
@Storage.set(int,MysteryDungeon.RoomPositionX,<System.random(1,<Storage.get(int,MysteryDungeon.MapSizeX)>-<Storage.get(int,MysteryDungeon.RoomSizeX)>-1)>)
@Storage.set(int,MysteryDungeon.RoomPositionZ,<System.random(1,<Storage.get(int,MysteryDungeon.MapSizeZ)>-<Storage.get(int,MysteryDungeon.RoomSizeZ)>-1)>)

# This is part of the Mystery Dungeon Generator API.
# Init Variable.
@Storage.set(int,MysteryDungeon.CurrentDigRoomX,<Storage.get(int,MysteryDungeon.RoomPositionX)>)
@Storage.set(int,MysteryDungeon.CurrentDigRoomZ,<Storage.get(int,MysteryDungeon.RoomPositionZ)>)
@Storage.set(int,MysteryDungeon.CurrentDigRoomID.1,0)
@Storage.set(bool,MysteryDungeon.RoomDigCompleted,false)

# Dig Room Procedure.
:while:<Storage.get(bool,MysteryDungeon.RoomDigCompleted)>=false
   :if:<Math.int(<Storage.get(int,MysteryDungeon.CurrentDigRoomX)>)><<Math.int(<Storage.get(int,MysteryDungeon.RoomPositionX)>+<Math.int(<Storage.get(int,MysteryDungeon.RoomSizeX)>*1)>)>
     @Storage.set(int,MysteryDungeon.CurrentDigRoomID.1,<Math.int(<Math.int(<Storage.get(int,MysteryDungeon.CurrentDigRoomX)>)>*1000000)>+<Storage.get(int,MysteryDungeon.CurrentDigRoomZ)>)
     @text.log(<Math.int(<Storage.get(int,MysteryDungeon.CurrentDigRoomX)>*1000000)>+<Storage.get(int,MysteryDungeon.CurrentDigRoomZ)> = <Storage.get(int,MysteryDungeon.CurrentDigRoomID.1)>)
   :endif
   
   # Digging Algorithm.
   @Text.log(MysteryDungeon.CurrentDigRoomID.1: <Storage.get(int,MysteryDungeon.CurrentDigRoomID.1)>)
   @Text.log(MysteryDungeon.CurrentDigRoomX: <Storage.get(int,MysteryDungeon.CurrentDigRoomX)>)
   @Text.log(MysteryDungeon.CurrentDigRoomZ: <Storage.get(int,MysteryDungeon.CurrentDigRoomZ)>)
   :if:<Storage.get(int,MysteryDungeon.Processor)>>0 <and> <Storage.get(bool,MysteryDungeon.RoomDigCompleted)>=false
     @Entity.remove(<Storage.get(int,MysteryDungeon.CurrentDigRoomID.1)>)
     :if:<Storage.get(int,MysteryDungeon.CurrentDigRoomX)><<Math.int(<Storage.get(int,MysteryDungeon.RoomPositionX)>+<Storage.get(int,MysteryDungeon.RoomSizeX)>-1)>
       @Storage.update(int,MysteryDungeon.CurrentDigRoomX,add,1)
     :else
       @Storage.update(int,MysteryDungeon.CurrentDigRoomZ,add,1)
       @Storage.set(int,MysteryDungeon.CurrentDigRoomX,<Storage.get(int,MysteryDungeon.RoomPositionX)>)
       :if:<Storage.get(int,MysteryDungeon.CurrentDigRoomZ)>><Math.int(<Storage.get(int,MysteryDungeon.RoomPositionZ)>+<Storage.get(int,MysteryDungeon.RoomSizeZ)>-1)>
         @Storage.set(bool,MysteryDungeon.RoomDigCompleted,true)
         :exitwhile
       :endif
     :endif
   :endif
:endwhile
:end
 
Last edited by a moderator:

nilllzz

Original Developer
Administrator
P3D Developer
Could you specify which part of the script doesn't work, in particular, which script call fails?
 
J

jianmingyong

Guest
Could you specify which part of the script doesn't work, in particular, which script call fails?
I think is
@Storage.set(int,MysteryDungeon.CurrentDigRoomID.1,<Math.int(<Math.int(<Storage.get(int,MysteryDungeon.CurrentDigRoomX)>)>*1000000)>+<Storage.get(int,MysteryDungeon.CurrentDigRoomZ)>)
The math result started haywire after this and I log them into log.dat to see the result.
 

nilllzz

Original Developer
Administrator
P3D Developer
What range of numbers can be stored here:
<Storage.get(int,MysteryDungeon.CurrentDigRoomX)>
?
 
J

jianmingyong

Guest
<Storage.get(int,MysteryDungeon.CurrentDigRoomX)>
It can store any number from 1 to about 39.
It should increase the number by 1 everytime it remove an entity and it will reset back to the starting number once it reach the room size value.
 

nilllzz

Original Developer
Administrator
P3D Developer
And erm...
What is actually wrong about it?
Like, can you tell me a simplified version of the script call that shows me what is wrong with the <math.int> construct without needing to understand your script?
 
J

jianmingyong

Guest
And erm...
What is actually wrong about it?
Like, can you tell me a simplified version of the script call that shows me what is wrong with the <math.int> construct without needing to understand your script?
Like this one: the most simplest <Math.int(13000000+24)> Results 13000020
 

nilllzz

Original Developer
Administrator
P3D Developer
https://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx

The larger (in char count) the number is, the more unspecific it is.
In 0.52.1, the internal <math.int> used a separate parser and converter, with the Integer data type. The new one uses <math.sng>, then converts the result to an integer.
I will see that I can implement a <math.dbl> construct for larger numbers, which will use the Double data type.
 
Last edited:
J

jianmingyong

Guest
Since this is applied to next version, lets call this fixed.
 
Top