Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Jacobwde12 on September 26, 2014, 06:00:02 PM

Title: Help on Popup Text Function
Post by: Jacobwde12 on September 26, 2014, 06:00:02 PM
I'm trying to make a map and I'm kind of confuse with the PopupText command. How do I seperate the payload,interval, and range variables into different lines?

# Friendly Core.crpl
# Created on: 9/25/2014 8:06:28 PM
# ------------------------------------------
$payload:-50
$interval:30
$range:30



once
#Make Popup Text
SetPopupText("Payload:" <-payload concat "Interval:" <-interval concat concat "Range:" <-range concat concat)
SetTextAnchor

#Connectible tower
Self CONST_CONNECTABLE 1 SetUnitAttribute

# Can Request Packets
Self CONST_CANREQUESTAMMO 1 SetUnitAttribute

# Request Packets
Self CONST_REQUESTPACKETS 1 SetUnitAttribute

# Maximum number of Packets
Self CONST_MAXAMMO 15 SetUnitAttribute
15 ->maxammo
endonce

#Gets current ammo
Self CONST_AMMO GetUnitAttribute ->ammo

#Make loogies if it has packets and give the ability to move
<-ammo <-maxammo eq if
# Setup an initial movement. 
once
   RandCoords swap 2 div swap 1 QueueMove
endonce

# If the current movement queue is empty, pick a new spot to move to.
GetQueuedMoveCount eq0 if
   # We will move randomly around on the left side of the map.
   # So we pick Random Coordinates, but then divide
   # the X coordinate by 2 so it is on the left side of the map.
   RandCoords swap 2 div swap 1 QueueMove
endif

Delay(<-interval)
@Spit

:Spit
RandCoordsInRange(CurrentCoords <-range) ->targetY ->targetX
CreateUnit("CRPLCORE" CurrentX CurrentY) ->loogie
AddScriptToUnit(<-loogie "Loogie.crpl")
SetScriptVar(<-loogie "Loogie.crpl" "targetX" <-targetX)
SetScriptVar(<-loogie "Loogie.crpl" "targetY" <-targetY)
SetScriptVar(<-loogie "Loogie.crpl" "payload" <-payload)
"Explosion5" PlaySound
endif
Title: Re: Help on Popup Text Function
Post by: knucracker on September 26, 2014, 07:16:39 PM
Line feeds don't mean anything in CRPL (unless they are inside a literal string).  They basically count as white space just like "space" does.  So you can break up things on different lines however you like.
Title: Re: Help on Popup Text Function
Post by: Flabort on September 30, 2014, 09:59:11 AM
Put linebreaks here, at the beginnings of these strings:
QuoteSetPopupText("Payload:" <-payload concat "
Interval:" <-interval concat concat "
Range:" <-range concat concat)
Within the literal string.