XD help me fix my slide trigger, <Major Noob> XD

M

Mythic Fr0st

Guest
Help me fix my slide trigger, its fun! you get to see what kind of strange things get processed by my mind! XD

PHP:
function Trig_Slide_Actions takes nothing returns nothing
  local real x
  local real y
  local real a
  local real L
  local integer i = 1
     set L = GetUnitLoc, udg_Raq[i]
     set x = GetUnitLoc, udg_Raq[i], 40*cos
     set y = GetUnitLoc, udg_Raq[i], 40*sin
     set a = x*y
     if GetTerrainType(L) not ( equal to "lice") then
     call SetUnitPosition udg_Raq[i](a)
     
endfunction

//===========================================================================
function InitTrig_Slide takes nothing returns nothing
    set gg_trg_Slide = CreateTrigger(  )
    call TriggerRegisterEventTimerPeriodic(Trig_Ice_Slide_Actions, .03)
    call TriggerAddAction( gg_trg_Slide, function Trig_Slide_Actions )
endfunction

I dont know what im doing lol
 

NiKaNoRoU_GR

New Member
Reaction score
115
Advices:
1.70%+ of your words consist of XD and lol.
At least lower it public
2.You could use
Code:
 tags thank you.
 

Monovertex

Formerly Smith_S9
Reaction score
1,461
Fr0zen said:
Code:
  if GetTerrainType(L) not ( equal to "lice") then

WTF :nuts:

It should be GetTerrainType(L) != 'the_rawcode_of_the_terrain_here' then

Attention: you must use ' not "
 
M

Mythic Fr0st

Guest
hmm

thanks Smith, XD lol :) I cant wait to till my next problems XD! lol, and no Lolz, nik XD I am nothing without lol and XD, XD is my friendly nooby face:) XD lol
lol is my sentence beginner and starter, most of the time lol, see like
Code:
 AND /CODE] tags :) lol, seriously cant stop it, and why would I use code tags on jass (Wth) ??!? ^_^
 
M

Mythic Fr0st

Guest
hmm

I've never seen you post jass... you dont post jass with code tags lol...
You dont even know jass XD as far as you've told me lol
 
C

CryptWizard

Guest
Basically, you have the syntax all wrong, here is just a bit of a guide on the syntax of JASS.

Code:
function Trig_Slide_Actions takes nothing returns nothing
  local real x
  local real y
  local real a
  local real L
  local integer i = 1
     set L = GetUnitLoc, udg_Raq[i]
     set x = GetUnitLoc, udg_Raq[i], 40*cos
     set y = GetUnitLoc, udg_Raq[i], 40*sin
     set a = x*y
     if GetTerrainType(L) not ( equal to "lice") then
     call SetUnitPosition udg_Raq[i](a)
     
endfunction

//======================================================================  =====
function InitTrig_Slide takes nothing returns nothing
    set gg_trg_Slide = CreateTrigger(  )
    call TriggerRegisterEventTimerPeriodic(Trig_Ice_Slide_Actions, .03)
    call TriggerAddAction( gg_trg_Slide, function Trig_Slide_Actions )
endfunction

Calling a Function
FunctionName(argument1, argument2, argument_etc)
Code:
set L = GetUnitLoc, udg_Raq[i]
should be
Code:
set L = GetUnitLoc(udg_Raq[i])
I have no idea what the next 2 lines mean.

Heres the correct syntax for the if statement:
Code:
if GetTerrainType(L) not ( equal to "lice") then
should be
Code:
if (GetTerrainType(L) != 'lice') then
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
You could just use my slide trigger:

Code:
function H2I takes handle h returns integer
    return h
    return 0
endfunction

function LocalVars takes nothing returns gamecache
    // Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
    return InitGameCache("jasslocalvars.w3v")
endfunction

function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    return null
endfunction

function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
 
function StopSlide takes unit Slider returns nothing
    local timer t = GetHandleTimer(Slider,"t")
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set t = null
    //Flushes the stuff attached to the timer, and destroys the timer, so you don't have to :).
    //call FlushHandleLocals(Slider)
endfunction

function ConstantSlide takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string ts = I2S(H2I(t))
    local unit S = GetHandleUnit(t,"S")
    local real A = GetStoredReal(LocalVars(),ts,"A")
    local real D = GetStoredReal(LocalVars(),ts,"D")
    local real Speed = GetStoredReal(LocalVars(),ts,"Speed")
    local real X = GetUnitX(S) + Speed * Cos(A * bj_DEGTORAD)
    local real Y = GetUnitY(S) + Speed * Sin(A * bj_DEGTORAD)
    //This will make it so you can still control the unit.
	//Uses the exact same formula as PolarProjectionsBJ.
     if RectContainsCoords(GetCameraBoundsMapRect(),X,Y) then
        call SetUnitX(S,X)
        call SetUnitY(S,Y)
    else
        set D = Speed
    endif
    if D != 0 then
        //Only if it's supposed to be sliding to a certain place will it check to see if it should stop the slide
        //Or restore the distance, for future checking.
        //(This way it won't keep restoring 0 for no reason)
        set D = D - Speed
        if D == 0 then
            call StopSlide(S)
        else
            call StoreReal(LocalVars(),ts,"D",D)
        endif
    endif
    set t = null
    set S = null
endfunction

function SimpleSlide takes unit Slider, real Distance, real Angle, real SpeedPerSec, real UpdateTime returns nothing
    //If the distance is 0, it will attach the timer to the unit
	//(and the unit to the timer for the sliding part)
	//and it will constantly slide until you call the StopSlide function
	//or until you destroy the timer.  
	//(Not recommended, since the stopslide function will destroy the timer
	//and remove all the leaks/clean up the locals).
	local timer t = CreateTimer()
	local unit S = Slider
	local real D = Distance
	local real A = Angle
	local real Speed = SpeedPerSec * UpdateTime
	local real UT = UpdateTime
	local string ts = I2S(H2I(t))
    call StoreInteger(LocalVars(),ts,"S",H2I(S))
    call StoreReal(LocalVars(),ts,"A",A)
    call StoreReal(LocalVars(),ts,"D",D)
    call StoreReal(LocalVars(),ts,"Speed",Speed)
    call StoreInteger(LocalVars(),I2S(H2I(S)),"t",H2I(t))
    call StoreReal(LocalVars(),ts,"UT",UT)
    call TimerStart(t,UT,true,function ConstantSlide)
    set ts = ""
    set t = null
endfunction

Right now You can just call it with this:

call SimpleSlide(Unit,0.00,Angle,(SpeedoftheUnit REAL),0.04)

This will constantly move the unit toward the angle you give it, at the speed you give it, until you use this to stop the unit's sliding:

call StopSlide(Unit)

If you want to make it use the unit's facing angle, just modify this part:

Code:
    local unit S = GetHandleUnit(t,"S")
    local real A = GetStoredReal(LocalVars(),ts,"A")
    local real D = GetStoredReal(LocalVars(),ts,"D")

Which is under the ConstantSlide function. Change it to this:

Code:
    local unit S = GetHandleUnit(t,"S")
    local real A = GetUnitFacing(S)
    local real D = GetStoredReal(LocalVars(),ts,"D")

And if you don't want the unit to be able to move around while sliding, just pause the unit before and after the slide.
 
M

Mythic Fr0st

Guest
wow

Wow...

Complex lol, thanks ^_^ I'll see if I can do it XD i've never used gamecache before o_O

Hmm, why pause, why not at a timer, that runs it every .03 seconds... and also checks the terrain type?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • 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 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