Legacy GM Problem with Jumpto random

M

mehmehmeh1

Guest
I clamped the player character between the edges of the screen, and while it works well, part of the moveset is teleporting, so I used the jump to random action, and there are times in which it makes the player go out of bounds, resulting in the game crashing, is it because of the clamp?
Just if, here is the compile:

Compile started: 10:45:34 p.m.
"C:\Program Files (x86)\Steam\steamapps\common\gamemaker_studio\GMAssetCompiler.exe" /c /m=win /config="Default" /tgt=64 /obob=True /obpp=False /obru=True /obes=False /i=2 /j=2 /cvm /tp=2048 /mv=1 /iv=0 /rv=0 /bv=1763 /gn="1" /td="C:\Users\oscarenrique\AppData\Local" /cd="C:\Users\oscarenrique\Documents\GameMaker\Cache" /sh=True /dbgp="6502" /hip="127.0.0.1" /hprt="51268" /o="C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468" "C:\Users\oscarenrique\AppData\Roaming\GameMaker\Examples\1.gmx\1.project.gmx"

Reading project file....finished.
Compile Constants...finished.
Remove DnD...finished.
Compile Scripts...finished.
Compile Objects...finished.
Compile Timelines...finished.
Compile Triggers...finished.
Compile Rooms...finished.
Compile Extensions...finished.
Global scripts...finished.
Final Compile...finished.
Saving IFF file... C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win
Writing Chunk... GEN8
Writing Chunk... OPTN
Writing Chunk... LANG
Writing Chunk... EXTN
Writing Chunk... SOND
Writing Chunk... AGRP
Writing Chunk... SPRT
Writing Chunk... BGND
Writing Chunk... PATH
Writing Chunk... SCPT
Writing Chunk... GLOB
Writing Chunk... SHDR
Writing Chunk... FONT
Writing Chunk... TMLN
Writing Chunk... OBJT
Writing Chunk... ROOM
Writing Chunk... DAFL
Writing Chunk... TPAGE
Writing Chunk... CODE
Writing Chunk... VARI
Writing Chunk... FUNC
Writing Chunk... STRG
Writing Chunk... TXTR
0 Compressing texture... writing texture texture_0.png...
Writing Chunk... AUDO
Writing Chunk... SCPT
Writing Chunk... DBGI
Writing Chunk... INST
Writing Chunk... LOCL
Writing Chunk... STRG
Stats : GMA : Elapsed=6837.5502
Stats : GMA : sp=20,au=0,bk=2,pt=0,sc=0,sh=0,fo=1,tl=0,ob=24,ro=11,da=0,ex=0,ma=115,fm=0x48E80060
Asset Compile finished: 10:45:51 p.m.
-----------------------------------------------------------
executing C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win
-----------------------------------------------------------
"C:\Program Files (x86)\Steam\steamapps\common\gamemaker_studio\Runner.exe" -game "C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win"


***************************************
* YoYo Games Runner v1.0(999)[r32908] *
***************************************
RunnerLoadGame: C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win
#########################################################################
####!!!!$$$$$$ pwd - C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\
#########################################################################
RunnerLoadGame() - C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win
Checking if INIFile C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468/options.ini Exists
C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468/options.ini file contents: [Windows] CreateTexturesOnDemand=0 AlternateSyncMethod=0 VertexBufferMethod=1 SleepMargin=1
Process Chunk: SCPT 428
Process Chunk: DBGI 2924
Process Chunk: INST 4
Process Chunk: LOCL 1080
Process Chunk: STRG 12441
Reading File C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win
Loaded File C:\Users\oscarenrique\AppData\Local\gm_ttt_42167\gm_ttt_30468\1.win(145240)
IFF wad found
Get Resolution
Get Header Information
InitGMLFunctions
HighScore..SavePrePend = C:\Users\oscarenrique\AppData\Local\_1\
Game..Math..Graphic..Action..File..Resource..Interaction..3D..Particle..Misc..DS..Sound..Physics..Gamepad..Buffers..Networking..Shaders..InitPushFunctions...YoYo..Fini
Code_Load()
VARI_Load()
got 1 global variables
got 9 instance variables
got 2 local variables
ID_STRG
Create Window
AdjustWindowRectEx
RegisterClassEx
CreateWindowEx
GAMEPAD: 40 axis values (last) at 0x37b8bd8
GAMEPAD: 40 axis values (last) at 0x37b93b0
GAMEPAD: 40 axis values (last) at 0x3ec53a0
GAMEPAD: 40 axis values (last) at 0x3ec5b78
GAMEPAD: 40 axis values (last) at 0x3ec6350
GAMEPAD: 40 axis values (last) at 0x3ec6b28
GAMEPAD: 40 axis values (last) at 0x3ec7300
GAMEPAD: 40 axis values (last) at 0x3ec7ad8
GAMEPAD: 4 axis values (last) at 0x385ee00
GAMEPAD: 4 axis values (last) at 0x385ede0
GAMEPAD: 4 axis values (last) at 0x385edc0
GAMEPAD: 4 axis values (last) at 0x385eda0
Init Graphics
GR_D3D_Init()
Enable DwmEnableMMCSS
Create D3D9Ex interface
Enumerate Adapters
Switching to manual clears
Selected Resolution: 640x480
Prepare to create device
Creating D3D device - ARGB=32bit, D24S8, SwapEffect=Copy, Hardware vertex processing
Creating screen render target
Get Device Caps
Graphics initialisation end...
Background_InitTextures()
Sprite_InitTextures()
Font_InitTextures()
IO Init
Process Messages
Splash!
Start Frame
Part Create Textures
Debug Init Remote Interface
VM Init
Create Score Form
Create Load Form
Create Error Form
Do The Work
LoadGameData()
initialise everything!
Process Chunk: GEN8 176
Process Chunk: OPTN 64
Process Chunk: LANG 12
Process Chunk: EXTN 4
Process Chunk: SOND 4
Sound_Init()
Process Chunk: AGRP 4
Process Chunk: SPRT 57076
Process Chunk: BGND 52
Process Chunk: PATH 4
Process Chunk: SCPT 4
Process Chunk: GLOB 4
Process Chunk: SHDR 4
Process Chunk: FONT 2484
Process Chunk: TMLN 4
Process Chunk: OBJT 8236
Process Chunk: ROOM 14944
Process Chunk: DAFL 0
Process Chunk: TPAG 1096
Process Chunk: CODE 6112
Process Chunk: VARI 1432
Process Chunk: FUNC 1292
Process Chunk: STRG 4344
Process Chunk: TXTR 47684
Process Chunk: AUDO 4
Wave_Init()
PrepareGame()
Extension_Prepare()
Code_Constant_Prepare()
Script_Prepare()
TimeLine_Prepare()
Object_Prepare()
Preparing 24 objects:
Objects 0: ject1
Objects 1: object10
Objects 2: object2
Objects 3: object34
Objects 4: object21
Objects 5: object33
Objects 6: bject5
Objects 7: object7
Objects 8: object8
Objects 9: object12
Objects 10: object14
Objects 11: object15
Objects 12: object17
Objects 13: object18
Objects 14: object22
Objects 15: object23
Objects 16: object24
Objects 17: object25
Objects 18: object26
Objects 19: object30
Objects 20: object31
Objects 21: object32
Objects 22: pause
Objects 23: object27
Room_Prepare()
Sound_Prepare()
InitGraphics()
Finished PrepareGame()
Run_Start
Total memory used = 457681(0x0006fbd1) bytes
**********************************.
Entering main loop.
**********************************.
Compile finished: 10:50:24 p.m.
 
M

mehmehmeh1

Guest
no, it just happens like when any other program crashes (like, it just says that it stopped working)
 

CloseRange

Member
you should show the code or tell us the exact drag and drop sequance it might be more useful then the whole entire compile window.
Also in a jump to random action you shouldn't need a clamp. in drag and drop there are 2 numbers which you can set to be the bounds of the jump.
and in code you just say:
Code:
x = random(room_width);
y = random(room_height);
and that will bound your character to the room
 
M

mehmehmeh1

Guest
It's just "Z-Key" "Jump to a random position"
The code for the clamp is

{x = clamp(x, -32, 575);
}

I used it because the character can also move from left to right and I don't want it to leave the screen
 
I'm not sure how moving your player out of the screen would cause your game to crash.

How big is your room and/or view settings?

You have -32 and 575 as the clamp limits. Wouldn't -32 put your player outside of your room?

What are the values you are using for your Jump To Random Position Action?
 

Yal

šŸ§ *penguin noises*
GMC Elder
If the game "just stops working" chances are the random jump is an infinite loop... make sure the loop where you try out random positions is aborted when the player is in a valid spot. Show us the code for that, please.
 
M

mehmehmeh1

Guest
you should show the code or tell us the exact drag and drop sequance it might be more useful then the whole entire compile window.
Also in a jump to random action you shouldn't need a clamp. in drag and drop there are 2 numbers which you can set to be the bounds of the jump.
and in code you just say:
Code:
x = random(room_width);
y = random(room_height);
and that will bound your character to the room
heh, I changed jumpto random to that, and it worked (though now the character is sometimes under the floor
 

CloseRange

Member
heh, I changed jumpto random to that, and it worked (though now the character is sometimes under the floor
A fix to this would be to add a do until statement which is just like a while statement except it will always execute at least one time. You would use it like this:
Code:
do  {
     x =  random(room_width);
     y = random(room_height);
} until (!place_meeting(x, y, obj_wall));
This will just continue to put you in a random position until you arn't hitting a wall
 
Top